11 ms·
Osx-kvm: Run macOS on QEMU/KVM
- arendtio 8y agoPrevious post from 2016 with 89 comments: https://news.ycombinator.com/item?id=12556609 https://news.ycombinator.com/item?id=12556609
- loxias 8y agoYeah, one has been able to do this for some time now. A few years ago I had a setup where (and I admit much of this was for the aesthetic purity of it, not practical reasons), I used a legally purchased copy of macos, copied it unmodified to my VM server, and, with a decent amount of effort, and a patched qemu (for the SMC thingie -- i donno if by now the patch is in mainline), was enjoying a non pirated, non modified macos on a linux host. I even got USB and BLE passthrough working, so I could use the mac VM for iOS app development. It was quite effective. A more challenging project I did later (which I probably deserve some derision for not documenting and sharing) is "How to develop, sign, and upload iOS apps entirely from debian linux, entirely with F/OSS, no VM, no Xcode, just good ol' emacs and cmake". IIRC, there were very little Big Contributions I did, but plenty of assembling a large variety of other projects, bug fixing them, and making an integrated environment.
- mseidl 8y agoI really want this. I'm a hardcore linux guy(23+ years), but I have to run a windows vm for some instruments I have that wont run under wine. I hate windows. It sucks so much. Even just using it not that often with my instruments reminds me why I stopped using it.
- loxias 8y agoI'm very similar. other than you've got about 5 more years on me :D If you're referring to musical instruments, then yeah, that's the only reason I even have a windows 7 VM around. Although increasingly I've been able to get the necessary code to run under wine.... But yes: > I hate windows. It sucks so much. Even just using it not that often with my instruments reminds me why I stopped using it. Is basically my mental state as well. (and, hence, swore off windows around 2000) I'm curious though, how would having a pure (aka linux) dev environment for macos help you in your situation?
- loxias 8y agoOr maybe you were saying you want the Windows equivalent of this? The ability to make native windows apps from linux with ordinary tools? I don't know what it is, but I thought we've had that for some time now....
- mseidl 8y agoThat would also be good. But anything to reduce the amount I have to use windows.
- loxias 8y agoOnce again, I agree, every moment I have to touch windows (let alone the more recent versions, like 10) is a moment of pain. But how does a system that lets you compile iOS applications natively from linux decrease your windows usage? Oh, or were you referring to the "clean room" osx-kvm-debian project, not the "ios build system on debian" project?
- titanix2 8y agoI really want this. I'm a hardcore windows guy(23+ years), but I have to run a linux vm for some programs I have that wont run under WSL. I hate linux. It sucks so much. Even just using it not that often with my programs reminds me why I stopped using it.
- throwawaymanbot 8y agoYou are hysterical!!! But to be fair, Linux sucks in an entirely different way to windows. Linux sucks in a good way. At least compare apples to apples (no pun intended)
- loxias 8y agoI.... think I get the jokes guys, but you do know that I have no idea what part you're referring to.... >.< And if you'd tell me... maybe I'd help.... :P :)
- muxator 8y agoGreat! These are really two accomplishments that deserve to be shared.
- brazzledazzle 8y agoYou should document the ability to build, develop, upload and sign from Linux. Unless you think it will cause Apple to close the path to do so (I assume others have worked out something similar and it would be a shame to cut them off).
- tinus_hn 8y agoThat must have been a long time ago indeed because the last version you could 'buy' was removed from sale in 2013. But actually you didn't buy a copy, you bought a disc and a license to upgrade the software on one 'Apple branded machine'. I don't care if you run unlicensed software but it's not 'legally purchased' or 'non pirated'. You're just fooling yourself.
- loxias 8y agoYou have a partial point, and I may have been sloppy with my words. But on the whole, you do not, and while I might willingly fool myself about a great many things, this is not one of them. I'm well aware that the license agreement claims to forbid running it on non Apple hardware. However, no -- the software WAS "legally purchased" AND "not pirated". I purchased, from Apple.com, a mac-mini, then in the apple app store paid for a stand-alone install of macos. I believe it was $20. "legally purchased" -- I paid for it through the legitimate channel (as opposed to, say, buying it from anyone other than Apple Inc. like ebay) "not pirated" -- Piracy (in this, that is, not the captain hook kind) context means taking advantage of the fact that digital assets can be perfectly duplicated to escape paying for it. I paid for it. I didn't duplicate it. As to the issue of the Apple's "license agreement". On this we may simply view the world differently. It is my viewpoint that once a product is sold the original owner no longer is entitled to a reasonable expectation of control over its use. I can buy a screwdriver labeled "Only for use with Lowe's(tm) screws", and use it on whatever brand screws I want, because it's my screwdriver, and the notion that Lowe's gets to exert control over how I use a tool after I've legally bought it is I am aware that currently some interpretations of US law are not congruous with this. I frankly don't care. You have the right to believe whatever you want, but to me law does not define truth. Interpretations of law frequently codify things that are not. Regardless of bills passed or the outcome of court cases corporations are not (yet!) sentient entities, in 1897 Indiana the ratio of the circumference of a circle to its diameter was not exactly 3.2 -- it was pi, just like today, and all of my family members are equally human beings as anyone else despite much older laws asserting that some of them were 3/5th. "fooling yourself" is a waste of effort. I'm well aware -- I have no romantic delusions about, for instance my copy of IDA Pro or MATLAB for example. It's a tool I greatly benefit from, that I cannot even come close to affording, so I stole it. Sure, it's almost certainly the case that in the coming years I'll again be in a position to legally purchase several licenses for work use, but that doesn't change the fact that I still pirated them. But no, I legally purchased my copy of MacOS, it is not pirated, and I do not believe in the waste of time that is fooling ones self.
- psergeant 8y agoI had a client give me a meaty Mac laptop, and had no desire to carry two laptops. I imaged their install, and then formatted the machine, and ran their image in a VM, and treated the underlying machine as my own. Worked well for a little while
- loxias 8y agoCool! Glad it worked for you. (I'm mildly curious what the chipset was on the guest that MacOS was running in) But like, not curious enough that you should spend any effort to find out. Because I think one of the toughest parts was getting QEMU to make a machine macos would be happy with.
- danShumway 8y ago> A more challenging project I did later (which I probably deserve some derision for not documenting and sharing) is "How to develop, sign, and upload iOS apps entirely from debian linux, entirely with F/OSS, no VM, no Xcode, just good ol' emacs and cmake". Please write this blog post. I've no interest in running Mac OS for any reason other than to test software in it and use it as a developer account for cross-platform apps. This would be a huge boon to people like me.
- fredch 8y agoWill someone please update this with experiences with Ryzen?
- loxias 8y agoI would be more than happy to, in exchange for a Ryzen chip and board. :) [seriously!]
- unixhero 8y agoFor what aspects? Performance? Compatability?
- johnt15 8y agoIt works fine on OSX 10.12.6. You need the following customizations (not sure what's in OSX-KVM already): - tell explicitly it's a "Penryl" CPU (<model fallback='allow'>Penryl</model>) - force AES instructions in order to use encryption effectively (<feature policy='require' name='aes'/>) - explicitly define topology (<topology sockets='1' cores='8' threads='2'/>) - use usb-tablet (<input type='tablet' bus='usb'/>) for much more convenient mouse input that does not lock to window. Initial setup may need to be done with usb mouse (<input type='mouse' bus='usb'/>) All of the above need to be reflected in QEMU command line. I've been using this setup for last half year without issues (mostly heavy compiling). I'm looking forward porting this setup to 32-core Threadripper. Would be a hell of a beast that outperforms Apple HW that costs several times more.
- fenollp 8y agoSoooo any way this can help run OS X in docker?
- loxias 8y agoI googled <<osx docker>> and this was the 5th entry: https://github.com/Cleafy/sxkdvm https://github.com/Cleafy/sxkdvm Though maybe you can enlighten me -- why the heck would you want to? It's in a VM -- you already have fantastic isolation. Why clutter it with an extra layer of packaging that to my naive eyes adds no more value? Like, a cool hack might be running macos...._slowly_.... on a SBC like a raspi :D But when you have real virtualization, what's the use of docker? (honest question)
- TomMarius 8y agoDocker offers a simple way to provision the VM - install software, configure networking, execute apps... Docker itself is not a VM or isolation, it uses other tools for that (linux containers in the past, not sure how it works today), it's value is in the ease of use provided by its tooling.
- loxias 8y agoI'm familiar enough with Docker to know of it as a combination of lxc, cgroups, and probably other things so that I can have 1 machine, 1 kernel, and yet multiple userspaces. These userspaces are not (as i understand it) Securely Isolated from eachother, but enough so that if there existed some monstrosity of a complex piece of software, which required lots of dependencies and customization, it might make sense to put it in a chroot, or a docker for the CoW benefits. But what I'm not following (and again, I don't get the point of Docker, I don't use it, so in trying to learn I'm assuming you must know more...) is how it assists provisioning the VM as you say. Sure, it could _change_ the provisioning of the _host_ (i'm calling the inside of the docker container the host in this context). But it's not like the binaries being executed in the container is the mac operating system. It's a VM that within THAT is the mac operating system. If I have mac running on a VM on a linux host, I still need to log in to that mac guest to configure networking, execute apps, install software.... So how did adding docker to the picture make it easier? Hence my confusion.
- lathiat 8y agoI had various success with this repository, unfortunately the various XMLs for libvirt and the "sh" boot scripts all reference different paths and capitalizations of files (e.g. even for the firmware committed to the repository etc). However I did get it to work successfully with High Sierra at one point.
- loxias 8y agoYeah, when I got mine working I decided to just go from scratch.... you might even be able to use upstream qemu by now.
- NamPNQ 8y agoWhere I find the ISO file?
- nasoieu 8y agoIf you read TFA, you'll see you can get the .app file from the App Store and then turn it into an ISO with a script that's included. But you can also use your favourite torrent site, like The Pirate Bay, to get an ISO.
- loxias 8y agoIf you wanna be above board, I think you purchase a mac, and then on that mac run the apple app store, and then in that store buy a copy of macos. To my great surprise I found this on Amazon, and I'm curious about what others think is how apple hasn't demanded its removal: https://www.amazon.com/10-13-High-Sierra-Full-Install/dp/B07D3CYGW9/ https://www.amazon.com/10-13-High-Sierra-Full-Install/dp/B07...
- miduil 8y agoOSX-KVM has been super helpful for recovering old sparseimage-backups I've created back when I was still using a mac. This is because sparsebundlefs-fuse Linux driver doesn't work with this file-format (yet) and I don't have any access to a Mac. (Especially since recovering takes at least a dozen hours). https://github.com/torarnv/sparsebundlefs/issues/7#issuecomment-326625187 https://github.com/torarnv/sparsebundlefs/issues/7#issuecomm...
- whyagaindavid 8y agofor Virtualbox please see https://github.com/geerlingguy/macos-virtualbox-vm https://github.com/geerlingguy/macos-virtualbox-vm
- geerlingguy 8y ago(Note that I'll hopefully have the High Sierra support PR merged in soon.)
- blacksmith_tb 8y agoMy memory from having gotten an OSX guest running in Virtualbox on an OSX host was that video performance was pretty terrible. Virtualbox seems to only let Windows guests have real access to the GPU? The KVM/QEMU approach here sounds more promising along those lines (though maybe not on OSX hosts).
- tambourine_man 8y agoHow is graphic acceleration support these days? Does PCI passthrough work?
- ubercow13 8y agoYes, it is working for me with a nVidia card
- tambourine_man 8y agoHave you tried Adobe's Suite? Any glitches in Photoshop, specifically?
- pizza234 8y agoOn systems with a good support, it works great - it's transparent to the guest. I've been using it for around a couple of years, both with videogames and Lightroom.
- tambourine_man 8y agoThanks. That's enticing
- thcleaner 8y agoI have a setup running OSX via QEMU/KVM using this guide. But memory operations seems to be very limited.
- aasasd 8y agoLimited as in slow?
- thcleaner 8y agoyes
- SXX 8y agoCan you give an example? I compile a lot of stuff in my macOS VM and there basically no performance loss.
- thcleaner 8y agoI ran geekbench 4, the overall score was only 15-25% lower but the memory score was a lot lower like 80% lower
- SXX 8y agoI really doubt synthetic benchmarks are actually represent much since really I just tested it and some things are just weird. For instance memory bandwidth is only significantly lower in multi-core test which could be caused might be by both specific of Penryn CPU or some quirk in how Geekbench implement the test. Total score of my host against VM: Host: 3954 single / 13713 multi core macOS VM: 3770 single / 11630 multi core [0] https://browser.geekbench.com/v4/cpu/9430525 https://browser.geekbench.com/v4/cpu/9430525 [1] https://browser.geekbench.com/v4/cpu/9430512 https://browser.geekbench.com/v4/cpu/9430512
- SXX 8y agoAdditionally I just want to point out this is test done on absolutely default Ubuntu 18.04 with no VM optimizations whatsoever. It's totally possible to significantly improve VMs performance: * By installing / compiling different kernel: low latency preemption option, 1000 HZ timer frequency, etc. * Use HugePages to decrease memory fragmentation. * Play around QEMU own options since right CPU options and host / guest balance with CPU pinning are helpful. I used to improve my CPU-bound games performance on Windows VM a lot by doing some some fine tuning and I suppose macOS not much different.
- thcleaner 8y agoI have a i5 6500 running with this setup, but memory operations seems to be very limited in bandwidth and latency
- throwawaymanbot 8y agoThis is just awesome! :)
- exabrial 8y agoLe sigh, continuous integration of osx and iOS apps is near impossible using standard cloud providers. I would gladly take an osx geared towards the data center.
- landonxjames 8y agoWe have a pretty good CI setup for our iOS apps using (shockingly) Microsoft's TFS. Not sure about any other cloud providers, but I was surprised by how easy it was to get working on a MS product.
- johnnycarcin 8y agoI had a friend a few months back looking for a CI setup for iOS and they found the same thing. For anyone wanting to kick the tires, it is called "App Center": https://azure.microsoft.com/en-us/services/app-center/ https://azure.microsoft.com/en-us/services/app-center/.
- meddlepal 8y agoIn theory this should be possible on Google Cloud using nested virtualization or EC2 bare metal...
- loxias 8y agoIf you find me funding, I could give you CI for mobile app development, a decent MVP, in 3 months (which is me taking how long i think it takes and multiplying by 3) :P But, like a previous poster said, it _WOULD_ be in violation of Apple's ToS. So a legal budget would be required.
- meddlepal 8y agoWe actually need something like this internally for non mobile app reasons. We build telepresence.io at Datawire and macOS dev and testing is a huge pain. Interested in a job :) ?
- the_grue 8y agoHow does it compare to running a Hackintosh? Is it much easier to set up? Do you still need to have compatible hardware and to mess with drivers and system configuration? How easy are OS upgrades? How is the performance, including graphics? Any issues?
- SXX 8y ago> How does it compare to running a Hackintosh? Is it much easier to set up? I have no idea about Hackintosh, but you can efficiently just grab ready-to-use VM image somewhere and use it with libvirt/virt-manager, e.g convert VMWare one. It's just works. > Do you still need to have compatible hardware and to mess with drivers and system configuration? I only had issues with sound since QEMU doesn't have compatible sound hardware and HDA driver for Hackintosh didn't work out-of-the-box. This can be solved by passing USB audio card. Addition: obviously your CPU must support whatever instruction set macOS require otherwise it's won't work. > How easy are OS upgrades? There were some breakages, but they usually fixed within QEMU upstream in few weeks. Though this mean you might need recent QEMU sometimes. > How is the performance, including graphics? Performance is great. Surprisingly without GPU you can even run some image editing software with lag since Apple software OpenGL implementation is more or less working. Or you can just buy compatible GPU and pass it to VM, then it's also just work without any issues. > Any issues? My VM image HWID got banned from using App Store fairly soon. Fortunately Xcode and all software I possibly need can be downloaded without it so I never did any research on how Hackintosh users solve it. PS: Edited. Added note about SSE.
- the_grue 8y ago> My VM image HWID got banned from using App Store fairly soon I never heard about HWID on Mac OS X before, and quick googling didn't produce any information about HWID on Hackintosh. Are you sure that is the real issue? Where can I read more about HWID?
- SXX 8y agoSorry. I probably shouldn't have called it HWID, but the fact is: App Store account that I've registered using said VM was after about a months limited so I unable to use it. So I came to conclusion they detected it's was used on VM and limited it. PS: And yeah I tried to use another new store account that also stuck in same state.
- matthew-wegner 8y agoI've been running my macOS desktop in an ESXi VM for over a year now. I came from a hackintosh, but got tired of the fragility of some upgrades. Some notes on this setup: - Apple supports macOS running inside of ESXi. Officially, only on Apple host hardware (i.e. a Mac Pro, which is on the ESXi compatibility list). Apple even ships a VMXNet3 network driver in macOS. - For ESXi specifically, you have to patch the host to boot macOS on non-Apple hardware. There's an explicit "am I running on Apple hardware?" check in there. DrDonk's unlocker on GitHub is what you need. - You can specify board-id, ROM/MLB, etc values via your .vmx file. iMessage and everything work for me, but I'm also using identifiers from a real Mac Mini I retired a few years ago. I expect this will still work okay with generated data if you follow hackintosh guides. - I pass through a GPU and a USB controller card for input/output. For USB, find an FL1100 chipset card, like the Inateck models, which works out of box on macOS, Windows, etc. Recently I moved my boot drive to a passed-through NVMe for extra speed. My other drives are ESXi virtual drives backed by storage elsewhere on my network. - Most NVIDIA GPUs will need the NVIDIA Web Drivers to work. Kepler generation cards are the last to work out of box, and the only to currently work out of box on Mojave. If you don't need hefty performance, a GeForce GT 730 is a cheap card. Apple and NVIDIA are still not getting along, so I expect this will only get worse. - However, I've never been able to get an AMD card to initialize via passthrough. The PCI device is seen, but the EFI strings or whatever else Apple is using to determine initialization paths are wrong. I recently spent awhile trying to figure this out, going so far as to write my own SSDT tables for the device, but finally gave up. - This particular guide is using Chameleon, which is considered an outdated bootloader. Clover is far more flexible, and will work in VM setups that don't natively implement SMC like ESXi. (For the longest time Clover would crash an ESXi VM, but this now works as of a month or two ago). And finally, on the context of this whole thing--I switched from a real Mac Pro to a hackintosh years and years ago, when it became clear Apple didn't care about upgrading the hardware. They still don't. The last Mac Pro release was 2013 (the 2013 iPhone was a 5S!). They've been promising things will improve "soon". They're the world's most valuable company; if they actually cared, at the organizational DNA level, it would have happened by now.
- supernes 8y agoCan you please elaborate on your GPU passthrough setup? I was under the impression that NVIDIA have explicit checks to see if you're trying to virtualize a consumer brand GPU and throw an error in that case. I have a PC with a GTX 970 that I wanted to try a similar install on, unfortunately the i5-3570K in there doesn't support VT-d from what I can tell.
- twodayslate 8y agoSince everyone seems to be able to run macOS virtualized how come there aren't any cheap VPS that run macOS available?
- Maakuth 8y agoLegal issues, I bet. AFAIK there's no way to run macos without Apple hardware and comply with the license. You could run a VPS provider on Mac Pros I guess, but I doubt it would be cheap.
- matthew-wegner 8y agoPretty sure it's the license, specifically: (iii) to install, use and run up to two (2) additional copies or instances of the Apple Software within virtual operating system environments on each Mac Computer you own or control that is already running the Apple Software, for purposes of: (a) software development; (b) testing during software development; (c) using macOS Server; or (d) personal, non-commercial use. The grant set forth in Section 2B(iii) above does not permit you to use the virtualized copies or instances of the Apple Software in connection with service bureau, time-sharing, terminal sharing or other similar types of services.
- gnahckire 8y agoThere are, just not cheap compared to running something else.
- twodayslate 8y agoDo you have some examples? I am not aware of any.
- bdcravens 8y agohttps://www.hostmyapple.com/macvps.html https://www.hostmyapple.com/macvps.html I just Googled "mac os vps"
- scns 8y agoNeither cheap nor virtual, macincloud.com Not affiliated
- bodhibyte 8y agoMore discussion on Hackintosh VMs at https://www.reddit.com/r/hackintosh/ https://www.reddit.com/r/hackintosh/, just search for KVM, ESX, or Proxmox. For any one interested in using the Ryzen Threadripper for a Hackintosh VM, see https://www.reddit.com/r/hackintosh/comments/8knz91/threadripper_1950x_vega_64_kvm_success_one_issue/ https://www.reddit.com/r/hackintosh/comments/8knz91/threadri...
- x3sphere 8y agoI've been running a macOS VM on my Threadripper 1950X for awhile now. Passing through 8 cores with a GTX 1060 attached and it runs great. In the latest Ubuntu 18.04 LTS, no need to compile qemu from source either, the version from apt get works just fine.
- ianmunoz 8y agoIsn't this illegal? Aren't you only allowed to run OSX on Apple hardware?
- omnimus 8y agoSo is there any compatible laptop that will allow QEMU/KVM particulary witwith gpu passthrough? Is someone running something like that?
- equalunique 8y agoTheoretically you could run Linux headless on a Dell Latitude laptop, configure it to use the Dock's serial output for the main console, and then have it automatically boot the OS X VM with GPU pass through to the main screen. When you close the lid, Linux goes to sleep instead of OS X. You could disconnect it from the dock and just carry it around with you like a normal OS X machine. Open it up and OS X is there waiting for you. Connect it back to the dock and debug with another computer over serial and/or SSH whenever you need to troubleshoot.
- SXX 8y ago> and then have it automatically boot the OS X VM with GPU pass through to the main screen What GPU would that be? If it's integrated Intel there is very good chance it's wouldn't work. Last time I tried to get my Intel HD working in macOS VM attempt failed completely. As guys from Intel explained somewhere on mail list their Mac driver stack is quite different from what is there on Linux and Windows. This is why they for instance don't support their graphics virtualization (GVT-g) for macOS. And for mobile GPU like Nvidia / AMD there own set of problems why they don't work at all in VM.
- SXX 8y agoYou'll have much better chances if you can just buy external GPU since there are laptops with working IOMMU and there are people who got external GPU working in VM. Then for macOS it's going to be just normal PCI(e) device. Unfortunately (almost?) all mobile GPUs won't even initialize within VM. I'm not expert in hardware side of things, but I suppose laptop drivers expect specific topology since mobile GPU almost never have own connection to display and sometimes don't even have own ROM. Even if somebody will find a way to make passed mobile GPU work on Windows VM it's very unlikely same trick will just work for macOS.
- busterarm 8y agoThe last time I virtualized macOS, I had to find and use some arcane compiler flags to get homebrew or any builds to work.