12 ms·
Running macOS in a Virtual Machine on Apple Silicon Macs
- olliej 5y agoThere's also the linux equivalent: https://developer.apple.com/documentation/virtualization/running_linux_in_a_virtual_machine https://developer.apple.com/documentation/virtualization/run...
- thevagrant 5y agoI use Parallels for this and seems to do fine. Looking at the examples - quite verbose! let virtualMachineConfiguration = VZVirtualMachineConfiguration() virtualMachineConfiguration.platform = createMacPlaform() virtualMachineConfiguration.bootLoader = MacOSVirtualMachineConfigurationHelper.createBootLoader() Why not "VMConfigHelper.createBootLoader()" over "MacOSVirtualMachineConfigurationHelper.createBootLoader()" ?
- moreira 5y agoThis style of naming is common on everything Apple, all their APIs and SDKs and most things in Objective-C/Swift are verbose like this, it’s on purpose. I personally quite like it, but it can be jarring for people coming from other languages.
- smoldesu 5y agoI don't particularly mind it, but it does invoke unwelcome memories of sifting through an endless purgatory of PowerShell parameters...
- eyelidlessness 5y agoI’m a big proponent of verbose naming, but I suppose I should say in this context that I generally have a negative preference for terse naming. There are some exceptions to that preference, usually deferring to idiomatic usage, e.g.: - i or idx is often preferred over index - fn or fun is often used where function is a reserved word That said, I’m also cognitively sensitive to column width. I’m not “80 columns or fight”, but I definitely find longer lines of code challenging to follow. As such I prefer to balance verbosity by deferring to the context (lexical scope, imported module name/hierarchy, file name/path, general contextual assumptions that you’d already need to be effective in the codebase). I find both extremes jarring, and there’s usually an opportunity to optimize for both local understanding and reading without reaching those extremes (of course at the expense of keystrokes/autocomplete pitfalls, but once you’ve embraced verbosity at any level that’s assumed).
- Koshkin 5y agoIndeed, the use of standardized mnemonics and abbreviations rather than this kind of extreme verbosity is the key to code readability.
- eyelidlessness 5y agowhen it’s commonly understood!
- nick_ 5y agoI tried macOS in Parallels and it was _awful_. Significantly worse than Windows 11 ARM and Ubuntu ARM. It seemed like it had zero acceleration. Very poor experience. I just used the wizard to install it so I didn't do anything weird.
- thevagrant 5y agoI haven't run anything heavy and used it to isolate some work stuff. I thought Parallels would be using the MacOS virtualization framework? If not, it will be interesting to compare how other systems perform.
- sjoruk 5y agoI use Parallels often. You can choose to use either their own hypervisor or Apple’s. I haven’t compared them though, Apple’s is working fine for me.
- saagarjha 5y agoFrom what I hear, Parallels has out approximately zero effort into their Virtualization implementation, to the point where a toy I whipped up over the weekend has better usability than it does.
- ForOldHack 5y agoI tried too, and the word was "abysmal."
- sjoruk 5y agoAre you using Big Sur or newer for the host and guest? If so you should have hardware accelerated graphics which made a huge difference over Catalina.
- pdpi 5y agoBecause VZLinuxBootLoader and VZMacOSBootLoader are two different implementations of VZBootLoader.
- thevagrant 5y agook thanks, that does make sense.
- Koshkin 5y agoBe thankful for “MacOS”.
- LASR 5y agoThis is interesting from a product angle. Apple has historically not supported running macOS on VMs very well. A few years back I built the vm infrastructure for a CI/CD platform for iOS and macOS app developers. It wasn’t easy to do this in a technically and legally well supported manner. Why is Apple supporting this use case?
- thoughtsimple 5y agoThat’s not true. VMWare has worked well for years. I used on my Intel Macs for years.
- ForOldHack 5y agoIt is true, and its well documented: "The OS X EULA does allow for OS X to be virtualized on Apple hardware as both host and guest. This is why (as you note) VMware Workstation does not support OS X virtualization, but Fusion, ESXi, and vSphere do. All versions of VMware's apps check to ensure that you are running on Apple hardware and you are running a supported OS (as not all versions of OS X allow virtualization)." I am trying to get Snow Leopard+Rosetta virtualized under Mac OS 10.10 Yosemite, as well as get Mac OS 10.8 Lion to run under Snow Leopard ( software requirements, and supporting PowerMac application, Freehand ). Its a total complete uphill battle, that apple does not want to happen: "You are completely correct that the EULAs are unclear about the question of running 3+ OS X VMs on a single OS X host. This is a legal question, and not a technical one. For that matter, so is the limitation about which versions of OS X can be virtualized (ex: 10.6 virtualization requires the Server edition, and all VMware applications block you from virtualizing the Standard edition)." So, it actually is true, and there is proof in VMWare's documentation. Shall I quote that too?
- saagarjha 5y agoFWIW, Virtualization attempts to enforce this limit internally.
- plorkyeran 5y agoOld versions of macOS requiring the server version for use inside a VM was dumb, but there's nothing technically or legally difficult about satisfying that requirement.
- thoughtsimple 5y agoDoes it still give an error trying to log in with your Apple ID? I had a version of this working months ago but it was pretty useless without iCloud or my developer account. I guess I should test it.
- saagarjha 5y agomacOS virtual machines using Virtualization cannot sign in to iCloud.
- calypso 5y agoI have a Monterey VM running on my home server inside Unraid with virtualization. I can login to Apple developer accounts. I use this as a macOS gitlab runner VM. Or is my setup not what you’re describing?
- saagarjha 5y agoYeah, I’m talking about capital V Virtualization, the framework that Apple provides for making macOS virtual machines (and is used by this sample code). Signing in with your Apple ID is explicitly not supported in those.
- calypso 5y agoThanks for the clarification.
- kaladin-jasnah 5y agoIs there an official location where Apple states this? I'd be curious to see where it's said.
- saagarjha 5y agoNot that I know of, the sign-in will just fail because Apple refuses connections from these.
- 0x0 5y agoThis is maybe what UTM uses in the latest releases to virtualize macOS on ARM64? Works very well for me so far. https://github.com/utmapp/UTM/releases https://github.com/utmapp/UTM/releases
- thoughtsimple 5y agoCan you use iCloud?
- musicale 5y agoUTM appears to be based on qemu, and it has full emulation capabilities. edit: in addition to native virtualization, as noted below
- 0x6A75616E 5y agoUnder "Additional macOS features": - Hardware accelerated virtualization using Hypervisor.framework and QEMU - Boot macOS guests with Virtualization.framework on macOS 12+ So, it does use Virtualization.framework for macOS guests.
- deleted 5y ago[deleted]
- musicale 5y agoIndeed. Note that qemu has support various native virtualization platforms including kvm, macOS' hypervisor framework, and Windows hypervisor. I'm not sure whether qemu supports M1 macOS out of the box (though it does seem to support ARM Linux and Windows) though, so perhaps that's an added feature from UTM.
- waffle_maniac 5y agoWhat would I need to boot Mojave?
- saagarjha 5y agoNot this; Virtualization only really supports Monterey on Apple silicon.
- smoldesu 5y agoBecause you're interested in running the last version of MacOS that supports 32-bit software?
- waffle_maniac 5y agoYes and HaloMD.
- userbinator 5y agoQEMU.
- hardwaresofton 5y agoIs this recent? This looks like a game changer for the rentable mac instance business if there's some movement in the licensing landscape. I was watching the github actions launch issue around macOS to see how they would handle the licensing issue[1]. In the end GH/MS didn't comment due to some "NDA" -- would be easy to state if they went the license route so... [0]: https://github.com/actions/virtual-environments/issues/1814 https://github.com/actions/virtual-environments/issues/1814 [1]: https://github.com/actions/virtual-environments/issues/2604 https://github.com/actions/virtual-environments/issues/2604
- pdpi 5y agoThe page says "Availability: macOS 12.0", and that was released in October, so yeah, pretty recent!
- easton 5y agoLicensing didn’t change with 12.0, but the Macs you rent can now run multiple instances of macOS, which is nice I guess.
- musicale 5y agoAWS/EC2 offers x86 and M1 macOS machines as instances which you can rent in 24-hour increments. I could imagine them slicing those machines using virtualization, licenses permitting (apparently the 24 hour requirement is from Apple's license agreement.)
- saagarjha 5y agoAmazon offers bare-metal hardware, to my knowledge. I think MacStadium does too.
- cpuguy83 5y agoBefore Monterey's virtualization framework there was the hypervisor framework. It is a lot lower level and would be what the virtualization framework is built on top of.
- riffic 5y agohow about kernal-native containers? come on, apple.
- amiircoal 5y agoIm currently looking for a Linux distribution to run in an immutable VM on macOS. It will only be used to run a web browser. A browser is the primary way your machine can get compromised. Since it is immutable, restarting the VM will clear all files back to a clean slate. macOS has app sandboxing built-in, but it is not as good as a VM. I’m curious why this isn’t a more popular setup? Running a browser in an isolated VM seems like it should be a best practice. Does anyone else run a similar setup?
- zamadatix 5y agoIt's resource heavy to browse in a VM, particularly if you don't use a paravirtual GPU which would greatly increase attack surface, and highly inconvenient to have your browser cleared all the time. It's not unheard of though, Windows even has a built in functionality for this for high security enterprise users.
- thenickdude 5y agoIf you use a PCIe-passthrough GPU instead then the paravirtual security hole gets closed by the IOMMU.
- 2OEH8eoCRo0 5y agoI was trying to do this today except I only have a single GPU so it's tricky.
- walterbell 5y agoIf your primary OS supports a serial console, it's a bit easier.
- saagarjha 5y agoOk, but then you have to use a serial console to interact with the VM…
- anonymouse008 5y agoThis is only built to work out Code signing bugs for Mac GateKeeper bugs… kind of funny
- saagarjha 5y agoWhat do you mean?
- anonymouse008 5y agoIf you are 'fortunate' enough to catch weird code signing bugs, like MacCatalyst app with a few dylibs / so's then getting the correct code signature will be a game of cat and mouse -- Eskimo is even one to say just use a developer support credit because they are so hard. Well, the very first time a Mac sees an app, there are special GateKeeper error codes that are never repeated... so if you are unfortunate enough to not know this and test your app on all the Macs you have in your possession, and still can't identify the bug, it was most likely error coded at the very first run time... To which the solution is make a VM or do all the un-niceties of removing the special security from the Mac, safe boots and all.
- upbeat_general 5y agoA bit off topic but does anyone have a good lightweight vm gui that uses the new framework w/Monterey? Fusion and Parallels are expensive (and I personally don’t love the interface anyway), and I’ve found UTM a pain to setup. I’d like to just take an Ubuntu ISO (or macOS image) choose a disk size and be on with it. Preferably with support for snapshots, but not required. I spent a while searching for projects but most are no more than (not actively maintained) proof of concepts.
- jbverschoor 5y agoUTM
- saagarjha 5y agoSelf promotion, but I guess you’re specifically asking for it so I hope you’ll let it slide: https://github.com/saagarjha/VirtualApple https://github.com/saagarjha/VirtualApple. I’ve been using it for development so it’s “actively maintained” in the sense that if it breaks I’ll go fix it because I need it to work :P Do note that the framework for Linux asks for a kernel+disk rather than an ISO. I don’t support it at the moment (the project is macOS-focused) but it wouldn’t be too hard to add support for.
- WesternEdge 5y agoFusion is free now for personal use.
- e40 5y agoInteresting. I wonder if this is because it has really sucked in the last 6 months and this is some sort of hail mary? I have 2 machines with the latest VMware Fusion on it. An iMac (Intel) and a Mac Pro (2013). Both ran all versions of macOS flawlessly until a few months ago. Big Sur and Monterey have massive issues. I couldn't install from scratch anything Monterey. I had random hangs, installing new macOS guests. Just so many issues. It forced me to try Parallels Pro and I found it works fine. I'm in the process of switching over.
- 5y ago
- Koshkin 5y agoIs it possible to do this without the VM being “an Xcode project”?
- saagarjha 5y agoSure, just build the app and use it outside of Xcode. (Note that this is sample code, so I wouldn’t really recommend using it for actual work; you should pick something that’s more of a “product” instead.)
- RavlaAlvar 5y agoIs apple about to break into the cloud server market?
- elpakal 5y agoXcode Cloud
- tonyedgecombe 5y agohttps://developer.apple.com/xcode-cloud/ https://developer.apple.com/xcode-cloud/
- Outofthebot 5y agoI wonder if Beeper (https://www.beeper.com https://www.beeper.com) uses something like this to get you a macOS iMessage instance in the cloud. Was always curious how they could tout that seemingly impossible feature, but looks like this is a way to do it.
- hoherd 5y agoI would just love it if a project using something like this came out that allowed you to use a VM run old versions of applications (EG: perpetually licensed adobe products) that are no longer supported. Bonus points if they let us adjust the date that is presented to the VM so that the subcomponents that Adobe did not get a perpetual license on (EG: face recognition) that were sold as part of a perpetually licensed product continue to function. I literally have an old Mac Mini running an old version of macOS and its only purpose is to run Lightroom 6. I'd love to not have to do that.
- SmellTheGlove 5y agoWould RAM be a limiting factor there? I suppose macOS is ok on 8gb so as long as you have 16 to give another 8 to the guest you can do it. It’d also depend on the resource needs of that legacy app you want to run.
- isfazri 5y ago
- lisper 5y agoI have a whole stable of machines running Mavericks just because I have a huge investment in iPhoto. I would like to switch to Photos but every time I try to convert an iPhoto library to Photos it fails (after a very very long time).
- orobinson 5y agoOnce it’s up and running it’s fine but importing photo libraries into Photos is truely the worst software experience I have ever had. It took me weeks of on and off tinkering to get my partner’s photo library setup correctly and syncing with iCloud Photos. The worst part is that when it does fail there’s absolutely no indication to the user what went wrong. At best you’ll get some kind of generic error message, at worst it just hangs forever. Perfectly demonstrates how Apple’s “it just works” design philosophy falls apart when it doesn’t just work.
- fnord77 5y agogreat, now how about container virtualization
- vmception 5y agoThis is my moment
- saagarjha 5y agoM1 doesn't actually support nested virtualization ;)
- eisa01 5y agoRelated, does anyone know if it's possible to run Mac OS X 10.8 in a virtualized environment with GPU support? It's required to run iMovie to try to resurrect an old project VMWare for a long time doesn't support it, but not sure what capabilities Qemu has for GPUs emulation?
- mistersquid 5y agoIn December 2021, I decided to check the state of macOS virtualization using parallels 17. Parallels has exceeded my every expectation and seems to be full of “It just works!” Presently running an instance of macOS 10.8 (Mountain Lion) in Parallels 17, but I don’t know if it offers GPU support. Maybe check using a trial version?