Running OSX 10.8.2 in QEMU-KVM

It is always nice to have a possibility to run a virtual system to test various software designed for different platforms. Recently I have moved completely off from VirtualBox and started to use QEMU-KVM only. With GRSEC/PAX hardened kernel qemu-kvm works fine without any paxctl exceptions to its binaries or any modifications in the kernel config. I have managed to install and run iATKOS ML2 which is modified OSX 10.8.2 for PCs.  Maybe the following information might be handy to somebody wishing to virtualize 64bit OSX for testing.

My software specifications are as follows:

  • OS: Debian stable 64bit  with vanilla kernel 2.6.50 & GRSEC/PAX patches and kvm_intel module
  • QEMU-KVM  version 0.14.1 (Please check notes further on)
  • iATKOS ML2 (no links here, please find your copy..)

I have had best success with qemu-kvm version 0.14.1 because of the RTL8139 network driver in this version. I had no luck in 1.2.x or 1.1.x to get the virtual network card to work  and earlier versions were also buggy, so stick to this one (works fine for Windows,Linux,OSX,BSDs…).

Another important thing is that any newer OSX system wont even boot on APIC IDs that are 11 or less. And QEMU-KVM 0.14.1 reports APIC=0x11. But no worries, it is open-source after-all and a simple patch can fix this which I will show further on. So what we need is to download a proper QEMU-KVM version from here:   or direct download

Extract the file and modify the hw/apic.c like this :

user@Obelix:~/qemu-kvm-0.14.1/hw/BACKUP$ diff patched.apic.c apic.c 
<         val = 0x14 | ((APIC_LVT_NB - 1) << 16); /* version 0x11 */
>         val = 0x11 | ((APIC_LVT_NB - 1) << 16); /* version 0x11 */

Just make sure you change the 0x11 to 0x14 on line 737. Now you can configure make and install the package.

Before booting make sure the kvm_intel kernel module is loaded (Im on an INTEL CPU, did not try AMD kvm_amd)

There are some parameters to be passed on to QEMU-KVM when booting OSX so here is a quick summary:

    qemu-img create -f qcow2 lion.img 20G   (create an empty hdd for installation)
    kvm -m 1400 -vga vmware lion.img  -cdrom /PATH/TO/ISO.iso -boot d -cpu core2duo -net nic,model=rtl8139,macaddr=10:1f:74:55:11:21 -net user -no-kvm-irqchip

Once you are in the iATKOS boot menu hit F8 and enter these boot parameters:

    cpus=1 -v

We are just telling the bootloader to use 1 CPU and boot verbosely. You should boot to the setup menu where you create the OSX partition on the empty drive (use erase with label) and before hitting install select some custom options like PS/2 drivers (actually there are very few options to choose from in iATKOS ML2.

After installation you can boot OSX like so :

kvm -m 1400 -vga vmware lion.img  -cpu core2duo -net nic,model=rtl8139,macaddr=10:1f:74:55:11:21 -net user -no-kvm-irqchip

And dont forget to issue F8 cpus=1 boot flag



About astr0baby

Please run Adblock or similar... we have been told to do so since Carl Sagan wrote the Contact .
This entry was posted in Uncategorized. Bookmark the permalink.

7 Responses to Running OSX 10.8.2 in QEMU-KVM

  1. dany says:

    thanks as always for all:
    even if the comment has nothing to do:
    I wanted to wish you a “” (Merry Christmas) “” and happy new year!!!

  2. lyojo says:

    does the mac in qemu runs smoothly?

    • astr0baby says:

      the disk I/O is poor, but that is caused by the lack of virtio drivers for OSX, anyways I found it usable for some tests that I wanted to perform on a virtualized OSX.

  3. A.C says:

    Nice, I’m running grsec + apparmor + self-written kernel patches as well ;-P I once wanted to migrated to KVM as well, but the clipboard, file sharing stuff set me back a bit.

  4. pato says:

    how to convert dmg file to iso

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.