Mac app for virtualizing Linux and macOS (supports M1/Apple Silicon)

Overview

Microverse

Microverse is a thin virtualization app for macOS, which allows running Linux (and, soon, macOS) guest virtual machines, achieved with macOS' own virtualization framework.

Note that this does not do any emulation—the virtual machines run on the same hardware as the host machine (and therefore have the same architecture). This is particularly useful to create sandbox environments with minimal performance impact.

Requirements

This project makes use of APIs from the macOS 12 (Monterey) beta. ARM and Intel Macs should both work.

macOS 11 (Big Sur) is unsupported.

Running Linux

VZLinuxBootLoader is quite picky about its inputs. I had the best luck with Ubuntu cloud images, based on this helpful comment by @droidix on evansm7/vftool.

The following examples assume arm64, but x86_64 should work similarly (presuming you get the correct downloads).

Kernel

  1. Download a vmlinuz, like https://cloud-images.ubuntu.com/releases/focal/release/unpacked/ubuntu-20.04-server-cloudimg-arm64-vmlinuz-generic
  2. Add .gz to the extension of the downloaded file
  3. Unpack with gunzip in the Terminal

Initial RAM disk

The corresponding initrd can be used as-is: https://cloud-images.ubuntu.com/releases/focal/release/unpacked/ubuntu-20.04-server-cloudimg-arm64-initrd-generic

Startup disk image

The startup image can be used as-is: https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-arm64.img

License and credit

Released under the MIT license. SwiftTerm is used as a dependency.

I'm indebted to @KhaosT' MacVM and SimpleVM projects for demonstrating Virtualization.framework usage.

Comments
  • Build errors

    Build errors

    Getting these build errors building with Xcode 13 beta 4 on an Intel Mac.

    image

    I'm not on macOS 12 locally but it should at least build (so I can run it on my M1 with macOS 12), so not sure what's going on?

    question 
    opened by torarnv 9
  • GUI for Linux

    GUI for Linux

    Unlike the macOS VM stuff, VZMacGraphicsDisplayConfiguration seems to be available on x86_64, so it's possible that it might work to attach a display to a Linux VM.

    enhancement 
    opened by jspahrsummers 5
  • Remove Linux support

    Remove Linux support

    I was already on the fence about supporting the Linux and macOS codepaths, especially as it became clear that there is limited overlap in Virtualization.framework featureset between the two platforms.

    Then, although it probably wasn't his intention, @mxswd put the nail in the coffin by posing this question about when—if ever—a virtualized Linux VM would be superior to Docker. 😜 I think the answer is pretty conclusively "no," so let's just update Microverse accordingly.

    opened by jspahrsummers 1
  • Crash during macOS installation

    Crash during macOS installation

    Thread 34 Queue : com.metacognitive.Microverse.VirtualMachineController (serial)
    #0	0x00000001c3aa81f8 in dispatch thunk of AnySubscriberBase.receive(_:) ()
    #1	0x00000001c6081a40 in closure #1 in NSObject.KVOSubscription.init<τ_0_0>(_:_:_:_:) ()
    #2	0x00000001c6082e38 in partial apply for thunk for @escaping @callee_guaranteed (@guaranteed τ_0_0, @in_guaranteed NSKeyValueObservedChange<τ_0_1>) -> () ()
    #3	0x00000001c60337b0 in closure #1 in _KeyValueCodingAndObserving.observe<τ_0_0>(_:options:changeHandler:) ()
    #4	0x00000001c6033430 in specialized NSKeyValueObservation.Helper._swizzle_me_observeValue(forKeyPath:of:change:context:) ()
    #5	0x00000001c6084180 in @objc NSKeyValueObservation.Helper._swizzle_me_observeValue(forKeyPath:of:change:context:) ()
    #6	0x00000001b56a95dc in NSKeyValueNotifyObserver ()
    #7	0x00000001b5775de0 in NSKeyValueDidChange ()
    #8	0x00000001b5828b90 in NSKeyValueDidChangeWithPerThreadPendingNotifications ()
    #9	0x00000001b482ae60 in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ ()
    #10	0x00000001b482ae0c in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] ()
    #11	0x00000001b56c61b4 in -[NSProgress _setValueForKeys:settingBlock:] ()
    #12	0x00000001b56cb55c in -[NSProgress setCompletedUnitCount:] ()
    #13	0x00000002180fee18 in void Base::DispatchQueue::async<-[VZMacOSInstaller reportProgress:]::$_3>(-[VZMacOSInstaller reportProgress:]::$_3&&)::'lambda'(void*)::__invoke(void*) ()
    #14	0x0000000100b89e48 in _dispatch_client_callout ()
    #15	0x0000000100b93168 in _dispatch_lane_serial_drain ()
    #16	0x0000000100b9421c in _dispatch_lane_invoke ()
    #17	0x0000000100ba3b04 in _dispatch_workloop_worker_thread ()
    #18	0x0000000100aabfdc in _pthread_wqthread ()
    Enqueued from com.apple.virtualization.installer-messenger (Thread 32) Queue : com.apple.virtualization.installer-messenger (serial)
    #0	0x0000000100b8f538 in dispatch_async_f ()
    #1	0x00000002180f7614 in VzInstallation::InstallerMessenger::handle_send_progress(unsigned int) ()
    #2	0x00000002180f7300 in std::__1::__function::__func<VzShared::Messenger::Handler::Handler<VzInstallation::InstallerMessenger, unsigned int>(VzInstallation::InstallerMessenger&, void (VzInstallation::InstallerMessenger::*)(unsigned int))::'lambda'(Base::Xpc::Dictionary const&, Base::Xpc::Object), std::__1::allocator<VzShared::Messenger::Handler::Handler<VzInstallation::InstallerMessenger, unsigned int>(VzInstallation::InstallerMessenger&, void (VzInstallation::InstallerMessenger::*)(unsigned int))::'lambda'(Base::Xpc::Dictionary const&, Base::Xpc::Object)>, bool (Base::Xpc::Dictionary const&, Base::Xpc::Object)>::operator()(Base::Xpc::Dictionary const&, Base::Xpc::Object&&) ()
    #3	0x00000002180ab604 in VzShared::Messenger::dispatch(Base::Xpc::Dictionary const&) ()
    #4	0x00000002180f65a8 in invocation function for block in VzInstallation::InstallerMessenger::InstallerMessenger() ()
    #5	0x00000001b44bf1e8 in _xpc_connection_call_event_handler ()
    #6	0x00000001b44bdc08 in _xpc_connection_mach_event ()
    #7	0x0000000100b89f08 in _dispatch_client_callout4 ()
    #8	0x0000000100bada7c in _dispatch_mach_msg_invoke ()
    #9	0x0000000100b92f0c in _dispatch_lane_serial_drain ()
    #10	0x0000000100baf23c in _dispatch_mach_invoke ()
    #11	0x0000000100b92f0c in _dispatch_lane_serial_drain ()
    #12	0x0000000100b9421c in _dispatch_lane_invoke ()
    #13	0x0000000100ba3b04 in _dispatch_workloop_worker_thread ()
    #14	0x0000000100aabfdc in _pthread_wqthread ()
    #15	0x0000000100ab3c78 in start_wqthread ()
    
    bug 
    opened by torarnv 1
  • Shared directory support

    Shared directory support

    In theory, this adds support for sharing filesystems into a macOS guest. Unfortunately, I can't get mount_9p to work within the VM no matter what I do—so, parking this here for now.

    Resolves #13.

    opened by jspahrsummers 0
  • Spurious Swift compiler errors when editing in Xcode

    Spurious Swift compiler errors when editing in Xcode

    Project builds and runs successfully, but IDE integration complains about a lot of errors. This doesn't affect KhaosT/MacVM, so I'm not sure what I've misconfigured.

    tech-debt 
    opened by jspahrsummers 0
  • Thread safety not considered

    Thread safety not considered

    I wrote this in a rush and didn't pay enough attention to which callbacks happen in the background vs. the main queue. Audit all asynchrony and make sure it's sane.

    Also, we can put VMs onto their own dispatch queue.

    bug tech-debt 
    opened by jspahrsummers 0
  • Receiving Segmentation Fault 11 using any graphical app (iOS included)

    Receiving Segmentation Fault 11 using any graphical app (iOS included)

    Typical cause is always like this. Just different OpenGl, Metal errors for different apps.

    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
    Exception Codes: 0x0000000000000001, 0x0000000000000000
    VM Region Info: 0 is not in any region.  Bytes before following region: 4329668608
          REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
          UNUSED SPACE AT START
    --->  
          __TEXT                      102118000-102a70000    [ 9568K] r-x/r-x SM=COW  ...etryDashWorld
    Exception Note:  EXC_CORPSE_NOTIFY
    Termination Reason: SIGNAL 11 Segmentation fault: 11
    Terminating Process: exc handler [529]
    
    Triggered by Thread:  0
    
    Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
    0   CoreFoundation                	       0x1be3a17bc CFStringGetLength + 8
    1   libGFXShared.dylib            	       0x23bd68a04 gfxInitializeLibrary + 720
    2   GLEngine                      	       0x23bf23b8c gliInitializeLibrary + 68
    3   OpenGLES                      	       0x23bf1f784 eagl_init + 480
    4   OpenGLES                      	       0x23bf1f340 -[EAGLSharegroup initWithAPI:sharedWithCompute:] + 228
    5   OpenGLES                      	       0x23bf1e46c -[EAGLContext commonInitWithAPI:properties:] + 208
    6   OpenGLES                      	       0x23bf1e2c8 -[EAGLContext initWithAPI:properties:] + 268
    

    I suppose it is because wrong gpu config, though as I can see Virtualization.framework doesn't contains any public method for video card config. I'd tried to disable SIP of VM and set gpu NVRAM boot args but no any effect.

    -(id)init {
        if ([[self className] containsString:@ "_VZVirtualMachineStartOptions"]) {
            NSLog(@"Found %@", [self className]);
            bootLoader = self;
            [self hook_setBootMacOSRecovery:0];
        }
        return self;
    }
    
    +(void)load
    {
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
            [objc_getClass("_VZVirtualMachineStartOptions") swizzleInstanceMethod:@selector(setBootMacOSRecovery:) withMethod:@selector(hook_setBootMacOSRecovery:)];
        });
    }
    
    - (void) hook_setBootMacOSRecovery: (int) boot {
        printf("hooked");
        [self hook_setBootMacOSRecovery:1];
    }
    
    opened by iVoider 0
  • Aborting a macOS installation then reopening the document causes a crash

    Aborting a macOS installation then reopening the document causes a crash

    It's probably reasonable to trash the VM if an installation is aborted mid-way through, but it should at least not crash the app. (Especially annoying with document restoration at startup.)

    bug 
    opened by jspahrsummers 0
Releases(0.2)
Owner
Justin Spahr-Summers
Software engineering, technical leadership, management. Previously employed at Facebook and GitHub. Available for consulting work!
Justin Spahr-Summers
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

One more heads up: As Swift evolves, if you are not using the latest Swift compiler, you shouldn't check out the master branch. Instead, you should go to the release page and pick up whatever suits you.

Daniel Cohen Gindi 26.3k Jan 3, 2023
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

Version 4.0.0, synced to MPAndroidChart #f6a398b Just a heads up: Charts 3.0 has some breaking changes. Please read the release/migration notes. Anoth

Daniel Cohen Gindi 26.3k Jan 8, 2023
Infowind - An Open Graph Metadata extension for iOS, iPadOS & MacOS

Infowind ?? InfoWind is an Open Graph Protocol based Safari extension for iOS, i

Gokul Nair 0 Jun 22, 2022
A simple and animated Pie Chart for your iOS app.

XYPieChart XYPieChart is an simple and easy-to-use pie chart for iOS app. It started from a Potion Project which needs an animated pie graph without i

XY Feng 1.7k Sep 6, 2022
Line plot like in Robinhood app in SwiftUI

RHLinePlot Line plot like in Robinhood app, in SwiftUI Looking for how to do the moving price label effect? Another repo here. P.S. Of course this is

Wirawit Rueopas 234 Dec 27, 2022
Health Sample app using Swift, RxSwift, Anchorage, Charts

HealthSample First run pod install, then build the project and run in your devices or simulators. This project has used RIBs, Swift, RxSwift, Anchorag

null 4 Feb 11, 2022
Repository with example app for using Bar chart

Gráfico de Barras (Exemplo) Repositório com app exemplo para o uso do gráfico de Barras. O gráfico de barras é um gráfico com barras retangulares e co

Felipe Leite 0 Nov 5, 2021
Repositório com o app exemplo para o uso do gráfico radar.

RadarExample Repositório com o app exemplo para o uso do gráfico radar. É um método gráfico de apresentar dados multivariáveis, na forma de um gráfico

null 0 Nov 5, 2021
Demonstration of a Sketching App Using 3D Touch

ForceSketch ####Demonstration of a Sketching App Using 3D Touch #####Companion project to this blog post: http://flexmonkey.blogspot.co.uk/2015/10/for

simon gladman 108 Nov 13, 2022
Integrate beautiful minimalistic plots into your app.

PlotUI · Integrate beautiful minimalistic plots into your app. Installation You can use PlotUI as package dependency to your app using Xcode: github.c

Yasha Bubnov 32 Sep 10, 2022
A simple and beautiful chart lib used in Piner and CoinsMan for iOS(https://github.com/kevinzhow/PNChart) Swift Implementation

PNChart-Swift PNChart(https://github.com/kevinzhow/PNChart) Swift Implementation Installation This isn't on CocoaPods yet, so to install, add this to

Kevin 1.4k Nov 7, 2022
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Jan 5, 2023
A simple and beautiful chart lib used in Piner and CoinsMan for iOS

PNChart You can also find swift version at here https://github.com/kevinzhow/PNChart-Swift A simple and beautiful chart lib with animation used in Pin

Kevin 9.8k Jan 6, 2023
Simple and intuitive iOS chart library. Contribution graph, clock chart, and bar chart.

TEAChart Simple and intuitive iOS chart library, for Pomotodo app. Contribution graph, clock chart, and bar chart. Supports Storyboard and is fully ac

柳东原 · Dongyuan Liu 1.2k Nov 29, 2022
SwiftChart - A simple line and area charting library for iOS.

SwiftChart A simple line and area charting library for iOS. ?? Line and area charts ?? Multiple series ?? Partially filled series ?? Works with signed

Giampaolo Bellavite 1k Jan 2, 2023
SwiftCharts - Easy to use and highly customizable charts library for iOS

SwiftCharts Easy to use and highly customizable charts library for iOS Features: Bars - plain, stacked, grouped, horizontal, vertical Scatter Lines (s

Ivan Schütz 2.4k Jan 4, 2023
iOS-based charting library for both line and bar graphs.

JBChartView Introducing JBChartView - Jawbone's iOS-based charting library for both line and bar graphs. It is easy to set-up, and highly customizable

Jawbone 3.8k Jan 1, 2023
iOS/iPhone/iPad Chart, Graph. Event handling and animation supported.

#EChart A highly extendable, easy to use chart with event handling, animation supported. ##Test How To Use Download and run the EChartDemo project is

Scott Zhu 646 Dec 27, 2022
Dr-Charts Easy to use, customizable and interactive charts library for iOS in Objective-C

dr-charts Easy to use, customizable and interactive charts library for iOS in Objective-C Features: Multiple chart types Line / Multiple lines / Lines

Zomato 93 Oct 10, 2022