How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Creating ultra fast virtual machines of old operating systems for fun and profit
Post Reply
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Post by MattKC »

NOTE: This article is still a work-in-progress. I'm still working on my Snow Leopard VM so I'll be adding/editing parts of it as I work out more things. I just wanted to infodump what I've discovered so far so that I won't forget and in case it helps anyone else.

This is a simple guide for installing Snow Leopard in virsh/virt-manager/QEMU/KVM. Specifically, I'll be using virt-manager in this guide, however virt-manager is just a wrapper for virsh, which in this situation is just a wrapper for QEMU/KVM, so all of the information should be fairly interchangeable.

Note that this does not include GPU passthrough yet. While this is obviously the primary advantage to using QEMU/KVM here (over other VM solutions), as stated in the header, I'm still ironing out the kinks with that, but will update when I have more information. This does mean that, for now, you'll only have software rendering at your disposal, so gaming ability will be limited, but the OS will still work for most things.

There are two bootloaders I've managed to get this to work with: Chameleon and OpenCore. Clover I couldn't get working at all in QEMU/KVM, it threw an "X64 Exception" every single time, but the other two I found perfectly viable and there are pros and cons to each.

Installing with Chameleon

Chameleon is considered old and hacky by today's standards, however it is effectively tailor-made for the Snow Leopard era of Mac OS X, and as such it's generally easier to set up. If you want Snow Leopard with the least amount of effort, I recommend using this method.
  1. Acquire a bootable Chameleon ISO. This is available from this link, but in case it goes down, I've also mirrored it here:
    Chameleon-2.1-r2069.iso.zip
    (7.67 MiB) Downloaded 244 times
  2. Acquire Mac OS X 10.6. This is available from the Apple Developer website on the "More Downloads" page, though you will need an Apple account to access it. They've made the "More Downloads" page difficult to navigate to, so here's a direct link. Type in "10.6" into the "filter" and scroll down until you find "Mac OS X version 10.6 Snow Leopard build 10A432" and click the "User DVD" to download it. This is essentially a complete image of the retail CD. Ignore the other 10.6.x "builds" listed, these are only updates, not the actual OS installer.
  3. Convert the DVD to a disk. For some reason, Chameleon has trouble reading Snow Leopard as a CD. I'm not sure if this is a limitation of Chameleon, QEMU, or a combination of the two, but for whatever reason, we'll need to convert this to a disk instead.
    • To be fleshed out...
    • If you have a copy of Mac OS available, mount the Snow Leopard DVD, create a DMG, format it as GPT/JHFS+, label it "USB", mount it, and use ASR to "restore" the image to the DMG you just made with the following command:

      Code: Select all

      sudo asr --source "/Volumes/Mac OS X Install DVD" --target /Volumes/USB --erase --noverify
      
      This will produce an image that can be used in QEMU/KVM, though I'm hoping to find a way that works independently of Mac OS in case you don't have an readily available install.
  4. Create a new VM in virt-manager. There will be no existing Snow Leopard definition, so leave it as "Generic OS". Set up the HDD, RAM, and CPU however you wish. Ensure "Customize install" is checked before finishing because we'll need to make a few more changes.
  5. Set the chipset to "Q35" and leave the firmware set to "BIOS".
  6. Add the Chameleon ISO as a SATA CD-ROM and set it to the VM's only boot device.
  7. Add the Snow Leopard disk we created earlier as a SATA disk.
  8. Add a USB keyboard. QEMU defaults to PS/2 peripherals and Mac OS X has no native support for them. While support can be added with a kext, it's easier to just add a USB keyboard. virt-manager will have already added a USB "tablet" (to translate screen mouse events to "real" mouse events) so you don't need to worry about the mouse.
  9. From here onwards, everything should work normally. Start the VM, it should boot into Chameleon, which you can use to boot into "Mac OS X Install DVD", and then after a few minutes, the GUI installer will appear. Don't worry if the boot looks like it's stopped doing anything for a minute or two, it will load eventually.

    Installation should be straightforward. As usual, use Disk Utility to partition your hard drive, and then start installing to it. Feel free to install Rosetta (under Customize just before starting the installation) so you can play around with some older PowerPC apps too.

Installing with OpenCore

Coming soon...

Post-Install

All of this stuff is optional, but are highly recommended quality-of-life improvements.
  • Update to 10.6.8. If you're gonna be using 10.6, may as well be the most recent version of 10.6. However you'll need to put some care and attention in here: Apple changed a handful of PCI-related kexts that ended up breaking Hackintosh booting, which means if you install this, you'll need to rollback some of the kexts to their 10.6.7 versions (provided here).
    • In order to update, download the 10.6.8 "combo update" (i.e. including everything from 10.6.1 onwards so you don't have to install each update individually) from the Apple website.
    • Install it as normal onto your Snow Leopard install, but don't reboot. The next boot will fail until you rollback those PCI kexts.
      • If you did already reboot by accident, it's not the end of the world. You'll just have to boot into the installer DVD again to do the rollback.
    • Download these 10.6.7 kexts (source):
    • Replace the IOPCIFamily.kext and AppleACPIPlatform.kext in /System/Library/Extensions with the ones from the ZIP. The ZIP also contains Apple80211Monitor, but that doesn't appear to be necessary.
    • Ensure kext permissions are set correctly. If you don't have a tool to automate that, these Terminal commands will do it:

      Code: Select all

      sudo chmod -Rf 755 /System/Library/Extensions
      sudo chown -Rf 0:0 /System/Library/Extensions
      
    • You should now be safe to reboot and use your install as normal.
  • Install Xcode. You may not be a developer or programmer, but considering how old Snow Leopard is nowadays, there's a good chance you may need compilers around so you can get stuff running. Additionally, Xcode contains useful tools that may come in handy for debugging your Hackintosh.
    • Download Xcode 4.1. Much like the 10.6 retail DVD, this is available from the "More Downloads" section of the Apple website.
    • Install Apple Software Installer Update 1.0. For some reason, Xcode will fail to install due to being "untrusted" (yes, despite being Apple's own software). Apparently this is a Snow Leopard bug, and can be fixed by installing this update from the Apple website.
    • Now Xcode should install correctly.
User avatar
andreizabest
Posts: 55
Joined: Sat Dec 10, 2022 4:49 am

Re: How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Post by andreizabest »

I can't find the Snow Leopard build. All I see is a bunch of packages for Java, XCode, KernelDebug etc. I got my image from archive.org, retail dvd image. I searched for mac os 10.6 user dvd iso and it was the first result on google.
Also I have to ask would this work with Ryzen? I know AMD CPU's can be a bit temperamental with MacOS, in VirtualBox you can get away with 6700k CPU profile but what about QEMU or KVM?
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Post by MattKC »

andreizabest wrote: Mon Mar 06, 2023 8:50 pm I can't find the Snow Leopard build. All I see is a bunch of packages for Java, XCode, KernelDebug etc. I got my image from archive.org, retail dvd image. I searched for mac os 10.6 user dvd iso and it was the first result on google.
It's there. It's at the very, very bottom because it's sorted from newest to oldest, and naturally all of the updates/additions came after the retail release. Make sure you typed "10.6" into the search/filter so only relevant files are listed (in fact entering "10.6 Snow Leopard 10A432" specifically makes it show up immediately, which might be worth adding to the OP).

There are certainly other sources that will work fine, but the Apple website will obviously be the most trustworthy, so that's still what I recommend.
andreizabest wrote: Mon Mar 06, 2023 8:50 pm Also I have to ask would this work with Ryzen? I know AMD CPU's can be a bit temperamental with MacOS, in VirtualBox you can get away with 6700k CPU profile but what about QEMU or KVM?
I haven't tested extensively, but from my short time owning a Ryzen I seem to recall no issues running Mac OS in QEMU/KVM without requiring any AMD-specific patches to the OS (this article and these comments back that up). I'm not sure exactly how that works considering it's virtualization rather than emulation, but I guess the virtual CPU ends up being Intel-enough that Mac OS has no issue.
User avatar
andreizabest
Posts: 55
Joined: Sat Dec 10, 2022 4:49 am

Re: How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Post by andreizabest »

MattKC wrote: Tue Mar 07, 2023 7:25 am It's there. It's at the very, very bottom because it's sorted from newest to oldest, and naturally all of the updates/additions came after the retail release. Make sure you typed "10.6" into the search/filter so only relevant files are listed (in fact entering "10.6 Snow Leopard 10A432" specifically makes it show up immediately, which might be worth adding to the OP).

There are certainly other sources that will work fine, but the Apple website will obviously be the most trustworthy, so that's still what I recommend.
I'm sorry I might be stupid but I seriously can't see it. It's not there. The oldest thing I can see is XCode 3.2. Do I need to enroll in the apple developer program for this?
Capture.PNG
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Post by MattKC »

andreizabest wrote: Tue Mar 07, 2023 1:46 pm I'm sorry I might be stupid but I seriously can't see it. It's not there. The oldest thing I can see is XCode 3.2. Do I need to enroll in the apple developer program for this?
Hmm that's odd. It is true that I'm enrolled in the Developer Program, but I haven't seen any indication that they only show up because I am. That is the most likely explanation though, and if so, the OP needs to be revised.
PortalPlayer
Posts: 6
Joined: Sat Jul 29, 2023 12:09 am

Re: How I installed Snow Leopard with virsh/virt-manager/QEMU/KVM

Post by PortalPlayer »

You can download the Snow Leopard ISO from archive.org: https://archive.org/details/snow-leopard-install_202112

virt-manager does actually have a template for Mac OS X Snow Leopard, you just need to enable "Include end of life operating systems"

Oddly enough, only Mac OS X 10.6 seems to boot for me, any newer (for example, 10.6.7) and it would instantly reboot after then Chameleon screen. Setting the CPU configuration to "core2duo" makes it work, but then you'll lose out the benefits of CPU passthrough. My CPU is a Intel(R) Core(TM) i7-4790.

For PS/2 support, you can just install these kext files: https://bitbucket.org/RehabMan/os-x-voo ... downloads/
Post Reply