13 ms·
Documentation to set up a simple macOS VM in QEMU, accelerated by KVM
- terhechte 7y agoDo the special network / bluetooth services (iCloud, iMessage, Handoff, AirDrop, AirPods) work with this setup?
- Operyl 7y agoHandoff requires a very specific set of Bluetooth hardware iirc, and it would need to be entirely passed through. So most likely no. And I believe that some of the iCloud services (specifically those entangled with iMessage/FaceTime) will require a valid SN (you can “generate” one by brute force though). It’ll also require that you give it two interfaces, one Ethernet and one wireless (and it’ll sometimes need to start a small wireless network for things like Airdrop).
- terhechte 7y agoThanks! So if I were to build a new system just for this and could decide on the components, and had an old Mac Mini flying around whose SN I could take, then it should entirely be possible, right?
- Operyl 7y agoThat’s generally preferable, yes, but I believe the SN needs to match the model identifier, and it’s generally best to match the model closest to the hardware you’re using. At that point, if it’s a specialized rig for this, I’d just skip out on KVM and just install it. Sites like tonymacx86 have build guides they keep up to date with the “most compatible” parts.
- draugadrotten 7y agoHow is the performance compared to running macOS on the same hardware (ie Hackintosh style)?
- megous 7y agoI'm not using this script, but it's reasonable. Good enough for Safari/web testing, or even running Xcode/iPhone emulator.
- dotemacs 7y agoThat's good to hear. Is this a viable option to have running on a Linux box so that you can use it as a CI for testing iOS apps? Or to be specific, what kind of specs, i.e. the amount of RAM would be needed to have a reasonable performance? Thanks
- pmjordan 7y agoFor both iOS simulator and Safari, the lack of GPU acceleration can be a problem, depending on what/how you're trying to test, and also depending on OS version. I believe Xcode 11 requires a Metal-capable GPU in order to even run. As someone else has mentioned, you can however use IOMMU/PCIe passthrough with certain graphics cards to get acceleration inside the VM.
- ryeights 7y agoPoor unless you have a macOS-supported GPU to put through PCI passthrough. Otherwise, macOS will not use graphical acceleration and the system UI will be very glitchy (e.g. severe ghosting) and slow to respond.
- unixhero 7y agoWell there are 3 realistic options here: Intel igpus Nvidia AmdATI
- eikenberry 7y agoIs the non-GPU passthrough performance bad enough to impact non-graphical applications? Is the whole UI just slow without it?
- bluedino 7y ago
- megous 7y agoOne more thing (not mentioned in the docs) post-install is to use QemuUSBTablet-1.2.pkg, for nicer mouse interation.
- pmjordan 7y agoThis should no longer be necessary with newer Qemu versions (since 2.10 or 2.11 I think) as the USB tablet's device descriptor has been fixed to be standards-compliant in Qemu. (Source: I'm the author of both that driver and the Qemu patch but I've not been able to spend much time on macOS virtualisation lately so it's possible things have started breaking again.)
- megous 7y agoIntereesting, thank you. I've been using this habitually since 3-4 macOS releases back, and didn't realize this might be no longer necessary. Also thank you for the driver. :)
- vishesh92 7y agoDoesn't this violate Apple's licenses? AFAIR, MacOS is illegal to run on non-Apple hardware.
- eivarv 7y agoYou may violate Apple's EULA by running macOS on non-Apple hardware, but it's not illegal (it's not a criminal offence).
- chii 7y agomost people don't understand the difference between a civil offence and a criminal offence (which is what i would use the term "illegal" to describe). Violating a contract is not "illegal", but is a civil offense, and requires the other party to sue you to recover damages. Copyright infringement is also not "illegal", but is a civil offense (however, i do believe that a lot of copyright lobbies want to change copyright violations to be a criminal offence, so they won't need to sue, but instead use public prosecution to recover their damages).
- Hello71 7y agoThis is terrible legal advice. Criminal penalties for copyright infringement offenses have existed since at least 1897 in the United States, and at least 1921 in Canada.
- jlgaddis 7y agoWhile I understand the point you were trying to convey WRT the differences between civil and criminal offenses, copyright infringement is not a particularly good example of this. > The unauthorized reproduction or distribution of a copyrighted work is illegal. Criminal copyright infringement, including infringement without monetary gain, is investigated by the FBI and is punishable by fines and federal imprisonment. [0] [0]: https://www.fbi.gov/investigate/white-collar-crime/piracy-ip-theft/fbi-anti-piracy-warning-seal https://www.fbi.gov/investigate/white-collar-crime/piracy-ip...
- pjmlp 7y ago
- ajconway 7y agoI wonder if anyone had success in running macOS VM on macOS via hvf acceleration. Would be a great free alternative to VMWare Fusion and Parallels.
- pmjordan 7y agoVery recent versions of Qemu have "experimental" support for HVF, so in theory it should work. I haven't had a chance to try it yet, however, and it's possible that there are some MSRs or similar that aren't sufficiently supported yet. If this is something you(r employer/company) care about, feel free to get in touch as I suspect it's not too difficult to fix if it doesn't currently work.
- ajconway 7y agoI believe it did work 2 years ago, Veertu Desktop seemed to be based on the Qemu with HVF.
- lvh 7y agoYep, but back then I think it was just commercial -- I believe everything got upstreamed. (The nice thing about Veertu using HVF was that it could ship a virtualization product in the App Store.)
- Wowfunhappy 7y agoI know it's bad security, but I'd be more interested in this if it supported old releases, like Snow Leopard or at least Mavericks (the latter being the final release with the Acqua UI). I have a fantasy that I'll go back to Snow Leopard some day and live the rest of my life there, but then I remember hardware support is basically nonexistent. A very lightweight VM with GPU passthrough could work around that problem.
- Quequau 7y agoI too would do this.
- misnome 7y agoIt'd also be useful for testing software on old releases. I work on scientific software. We are currently.... considering... dropping snow leopard support, but partners keep insisting that they use ancient systems. (We had a fight to drop CentOS 5 this year).
- 120photo 7y agoI have a Epson Perfection 4490 with no 64bit drivers. I will need to either run Windows or a older version of Mac OS / OS X. I'm sure there are other use cases where one will need a older system. I was actually going to go down the route or building a new Hackintosh but have opted o build a Linux desktop with Mac OS VM using GPU pass through. Using this I could have the latest Mac OS and a older version when needed.
- pwg 7y agoSome info on getting the 4490 to work with Linux is here: https://www.patrickmin.com/linux/tip.php?name=epson4490 https://www.patrickmin.com/linux/tip.php?name=epson4490 The iscan-plugin-gt-x750 package referenced there was all I needed to get vuescan (https://www.hamrick.com/ https://www.hamrick.com/) to use the scanner on 64-bit Linux.
- trm42 7y agoHave you checked whether Vuescan or Silverfast supports your scanner model? They are quite amazing with supporting old hardware.
- StreamBright 7y agoWe should have a tool to create VMs on macOS as well. There is the new API but non of the FOSS tools using it. I am wondering why.
- sigmaris 7y agoI assume by "new API" for VMs on macOS you mean Hypervisor.framework, which is supported by qemu 4.0.0 and xhyve, both open-source. I wrote a blog article about using qemu with Hypervisor.framework to install Debian in a VM here: https://sigmaris.info/blog/2019/04/automating-debian-install-qemu/ https://sigmaris.info/blog/2019/04/automating-debian-install...
- StreamBright 7y agoExcellent! Thank you very much for sharing, this is exactly what I was looking for.
- pulkitsh1234 7y agocan this handle 'xcodebuild' ?
- asdkhadsj 7y agoThat's my question. This seems hugely useful to automate MacOS builds in a sane manner. Yet, due to licensing I do wonder if it's even worth caring about. If I use this at work I'd be risking my job on if Apple decides to sue my work for not following MacOS licensing for our build pipelines. If I use this in OSS / private software, I risk them suing me directly. Shame, all I want to do is streamline providing software for Apples customers. You'd think Apple would want that more than some small money from a hypothetical non-Apple user merely trying to deliver products, functionality and improved UX to Apples customers. I feel like our (my and Apples) incentives are aligned. /shrug
- mchristen 7y agoI think part of the reasoning, perhaps misguided, is for quality assurance. It's easier for them to say our stuff runs only on our 'certified' hardware then to try and support everything under the moon. These days I don't think that argument holds up though, back in the early days of x86 hardware and peripherals it made more sense. In a past life we used mac minis sitting on a shelf in a datacenter to run builds off of, it worked well enough.
- stevencorona 7y agoI recently went the KVM MacOS/Hackintosh route (but not using this exact script) and while it functionally worked great— GPU Passthrough (Used RX580 and Vega 56), PCI Passthrough (USB Controller/Bluetooth/Wifi/Ethernet Card/SATA Controller/NVME Drive), iMessage, Handoff, AirDrop, etc. etc. I found it to be hassle on my consumer AMD motherboard with an AMD GPU. With the AMD GPU, I had trouble resetting the GPU between VM starts/stops without restarting the whole computer. This appears to be a problem with a consumer AMD cards. It could be specific to AMD Ryzen IOMMU Groups, but it was also pretty annoying to passthrough the PCI devices and still leave the appropriate hardware for the host machine. There aren't any native virtio drivers in OSX so you really need to pass through your sata controller/ethernet card for full performance. Might have been easier with a server motherboard with cleaner IOMMU groups, though. I ended up just building a bare-metal Intel Hackintosh which was less of a hassle.
- derefr 7y ago> There aren't any native virtio drivers in OSX I could have sworn that macOS is supported as a guest under VMWare Fusion and/or ESXi hosts (when on Mac hardware), using some virtio drivers.
- tpoindex 7y ago> I ended up just building a bare-metal Intel Hackintosh which was less of a hassle. I think we need a new word to describe VM-hosted MacOS to distinguish from hardware hosted: QEMU + hack + Macintosh = Quackintosh ?
- exabrial 7y agoI've been interested in doing something like this so I can run an iMessage proxy. A lot of neat gateway apps for OSx have popped up (like https://www.wemessageapp.com https://www.wemessageapp.com) to get iMessage support on Android.
- camhenlin 7y agoI've been doing this for years with some of my own personal projects like https://github.com/CamHenlin/imessageclient https://github.com/CamHenlin/imessageclient, https://github.com/CamHenlin/iMessageWebClient https://github.com/CamHenlin/iMessageWebClient, and https://github.com/CamHenlin/imessagebot https://github.com/CamHenlin/imessagebot and some others - one thing that I'll note is that in my experience, Apple is pretty aggressive and somewhat arbitrary at banning accounts from accessing iMessages if they get on to the service from a VM - even if your usage is normal, personal iMessaging. I was trying out using VMWare and virtualbox specifically. In fact, I've been accidentally successful at getting my computer and home network banned from Apple services by accessing iMessages via VM. I strongly recommend running these types of services on bare metal Macs although ymmv.
- holy_city 7y agoThis falls on deaf years but I say it every chance I get. I would pay a significant premium to install MacOS on a machine without violating their ToS.
- awalton 7y agoBut then how would Apple sell you a Mac Mini?
- holy_city 7y agoI mean they're not selling me one now, I don't need a hot plate on my desk. But I would pay a (comparatively) obscene amount of money for just the operating system license to install on a midtower.
- gregmac 7y agoI'd buy a stack of Mac Mini's and leave them unplugged if it allowed me to provision dozens of Mac VMs on real server hardware.
- deagle50 7y agoNo kidding. I would pay their entire iMac hardware margin for an OSX desktop license.
- mgalgs 7y agoI'm afraid the markup would have to be a lot more than that. They're banking on you buying multiple pieces of hardware over the years, not just one iMac... Hardware lock-in is their whole business model...
- deagle50 7y agoWe're talking about people like me who build their own desktops and wouldn't buy an Apple desktop otherwise. They could even make it a subscription.
- Wowfunhappy 7y agoDoes anyone understand why this works on AMD processors without a custom Darwin kernel, as would be needed in a native AMD Hackintosh setup? The core x86 code is still getting executed natively, right? So, what magic does the VM perform?
- rubyn00bie 7y agoI just bought a used dual socket (E5 V2) server to play with KVM and to try do just this... I suspect, performance is probably pretty righteous even in the VM, and old xeon's like the 2667 V2 are dirt cheap these days. MacOS doesn't need much VRAM and old AMD cards are pretty cheap (GPU passthrough is easier with AMD cards [1]). I'm really looking forward to running this later. [1] I could be wrong on this, but from my previous research into gpu passthrough made it seem as though NVidias consumer cards aren't generally allowed to do it because they're driver locked.
- LeicaLatte 7y agoVery nice. If this works on ec2/droplets, I might have found a good solution for my iOS/macOS CI needs.
- dharma1 7y agoHow good is the passthrough perf? I'd like to build a hackintosh box with amd 3900x and amd rx5700 xt GPU - for video editing etc. KVM seems like the only choice for AMD cpus. Will the GPU work with KVM? What mobo should I get?