Run OS X in Linux with qemu

It is possible without too much difficulty to get OS X Leopard running as a guest in a virtual machine with Linux as the host without too much difficulty. It is illegal as far as I know unless you have Linux running on real Apple hardware and don’t want to reboot just to use OS X but if you’re in this boat you can also use Virtual Box which officially supports OSX guests on Apple hardware. If you don’t have Apple hardware you’re only option is qemu and now it’s possible with having to manually patch qemu.

Configuration:

Requirements:

An ISO of OS X

Recent version of Qemu.

A processor with virtualization technology, AMD-V or Intel VT-x capable. I’m not sure if it is technically required but it certainly helps.

Lots of Ram and disk space.

Getting OSX 10.5.6 Leopard:

iPC is one of many “distributions” of OS X for non-Apple computers. Check the iPC site for more information on using it. You won’t find any download there though, you’ll have to find a more creative source.

Installation:

First create an image file to hold the installation.

$ qemu-img create osx.img 20GB

This creates a 20 GB image file osx.img in raw format. Specify more GBs if you will want more space but I wouldn’t do any less then 10GB.

Start Qemu with the new image file and your installation ISO.

qemu-system-x86_64 -hda osx.img -vga std -m 2048 -soundhw ac97 -cdrom iPC\ OSx86\ 10.5.6\ Universal\ PPF5\ \(Final\).iso  -boot d

This will start qemu in 64 bit mode. “-hda osx.img” should be the name of the image file you created above. “-cdrom iPC\ OSx86\ 10.5.6\ Universal\ PPF5\ \(Final\).iso” should be the full path to your installation iso. “-m 2048″ is how many megabytes of memory you want to make available to the system. “-soundhw ac97″ is used to emulate the ac97 sound card which is supported by OSX. “-boot d” is used to tell the system to boot of the cdrom first.

If all goes well you should see this message:

Start osx installation

Pressing any kill should bring up the language selection menu:

OSX Language selection menu

If you don’t and it just stalls at the Apple logo. Try using F8 and then -v to startup with diagnostic messages. That might give you some clues as to what’s going on.

Click next and continue. Then accept the software agreement. Then it asks, “Where do you want to install Mac OS X?” and gives you a blank list of possible installation locations. This is because the image file has not yet been formated. Choose “Utilities” from the top and “Disk Utility”.

Formatting new hdd for osx

Select “QEMU HARDDISK”, choose “erase” from the top and click the “erase” button twice.

Formatting in OSX

The disk image is now formatted so close the Disk Utility. You should not have a destination avaliable to install OS X too. Select it and click “continue”. It is very important that you customize the installation on the next screen so you can install the proper drivers.

QEMU OSX driver selection

It’s very important that you select the 9.5.0 Voodoo Kernel or you will be unable to boot your new system. You will need the LegacyAppleIntelPIIXATA under chipset drivers or your hard drive will not work.

Audio and USB

For audio drivers select AC97 Audio which is under Other Audio Drivers. For Ethernet select PCGENRTL8139. If you want to try to get usb to work you will need the Patched USB drivers. Also the responsiveness of the mouse and keyboard can be improved by selecting the PS/2 Keyboard FIX under the fixes section.

Click “Done” and “Install”. Then in about 20 minutes you should have a working OS X installation.

Upon reboot you get a welcome screen asking for the region your in. The rest of the setup is pretty straight forward. You don’t have to register with Apple. Be sure to choose DHCP for network setup. Upon completion you’ll see the beautiful Leopard desktop.

Leopard Desktop in Ubuntu

Getting Networking to work

Networking in OS X on qemu has been rather tricky to do but following these directions makes it pretty simple. Close QEMU by shutting down OS X. Modify the qemu command to this:

qemu-system-x86_64 -hda osx.img -vga std -m 2048 -net nic,model=rtl8139 -net user  -no-kvm-irqchip -smb $HOME -soundhw ac97

The magic here is the “-no-kvm-irqchip” which disables a certain accelleration function that causes problems with networking being very slow in OS X. “model=rtl8139″ is chosen because that’s what we selected during installation. “-smb $HOME” is used to allow file transfers between the host and guest operating system.
To share files open finder. Choose Connect to Server… from the “go” menu. Enter “smb://10.0.2.2” in the server address. Choose “Connect as Guest”. Choose a volume and then it should mount it on the left side of the finder.

Getting Sound

If sound doesn’t work try installing the following updated driver.
Qemu ICH AC97 Audio Driver

Other Tweaks

If you want to take advantage multiple cores you can use the option “-smp 3″ which tells qemu to make 3 cores available to the guest machine.

Known Issues

Occasionally the system crashes. It seems to happen most often when I’m downloading large files such as Xcode.

No related posts.

This entry was posted in Linux, OS X and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Jamie Kirkpatrick
    Posted November 14, 2010 at 6:26 pm | Permalink

    Fantastic – thanks for posting this. I’ve spent about a week trying to get things to work and in the end your instructions were bang-on. Thanks for the work figuring out how to get networking sorted too.

  2. John Smith
    Posted May 22, 2012 at 1:01 pm | Permalink

    By the way your blog theme makes reading the box that contains:

    qemu-system-x86_64 -hda osx.img -vga std -m 2048 -net nic,model=rtl8139 -net user -no-kvm-irqchip -smb $HOME -soundhw ac97

    hard to read.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>