Edit: 2013-May-23 -- This doesn't seem to work with new versions of VirtualBox. VirtualBox 4.1.24 seems to be the last version where this will work.
I recently built a new computer and have been trying to get Mac OS X working on it. I don't like Macs well enough to use all the time, but I need one to build software for Mac. Although my machine is capable of being a hackintosh, it is usually easier to build software in a virtual machine which doesn't require restarting.
My old machine was a Core 2 Quad (Kentsfield), and I was easily able to install Snow Leopard in VirtualBox 4 using EFI emulation. However, my new machine is a Core i5 (Sandy Bridge) and the 10.6.3 install disc wouldn't boot in VirtualBox. I eventually ran across some sites saying that Core i users were having trouble using the EFI method and would need to use the standard hackintosh methods to run OS X on non Apple hardware.
I used the iBoot + Easybeast method developed by tonymac, but there were a lot of things that irritated me. Restarting the virtual machine causes a kernel panic. Selecting 'About this mac' from Finder caused Finder to crash, and with it, all currently running applications. There was no sound output at all (not that important to me, but an annoyance just the same). I thought I might be able to fix these problems by using VirtualBox's EFI emulation.
Then I remembered that Snow Leopard didn't initially run on Sandy Bridge machines. All the ones that shipped had modified versions of 10.6.7 installed. So I decided to combine installation strategies. I would configure VirtualBox to not use EFI and install using iBoot, upgrade to 10.6.8 (which supports Sandy Bridge), and then switch on EFI. This worked perfectly. Below are the steps for getting Snow Leopard 10.6.8 running in VirtualBox 4 using EFI emulation on your Sandy Bridge machine.
Requirements:
- iBoot 3 from tonymac (free, but forum registration required)
- 10.6.3 Snow Leopard install disc (other 10.6 install discs should work, but I haven't tested this).
- VirtualBox 4 (I'm using 4.1.4 on gentoo Linux amd64)
- Sandy Bridge core i machine (other machines may work, but I haven't tested this)
- Intel VT-x virtualization available and enabled in BIOS
- Patience (took me about an hour)
Installation Outline:
- Create virtual machine in VirtualBox.
- Boot machine using iBoot CD image
- Install Snow Leopard
- Use iBoot to boot into new Snow Leopard
- Update to 10.6.8 using Combo Updater
- Reconfigure VirtualBox for EFI
- Boot your new Snow Leopard EFI Virtual Machine
Step 1 - Creating the Virtual Machine
Start VirtualBox 4 and create a new machine. Name it whatever you like, but make sure operating system is Mac OS X and version is Mac OS X Server or Mac OS X Server (64 bit). The 64 bit version doesn't actually do anything useful from what I can tell. You don't need it to run Snow Leopard in 64 bit mode. I kept all the defaults for the basic configuration options (1 GiB memory, 20 GiB hard drive). It shouldn't affect anything if you change these, but I haven't tested that.
Edit the settings and go to the System settings. Make the CD/DVD-ROM first in the boot order list. You also need to uncheck Enable EFI. Then go to the Display settings. Set Video Memory to 64 MB and check Enable 3D Acceleration. On the Storage settings, you can select the iBoot ISO for the CD image. Everything else should be good like it is.
Step 2 - Booting using iBoot
Now that your machine is configured, it's time to start it. iBoot comes up very quickly. Once it does, you need to change the CD image to your Snow Leopard DVD. You can use the CD icon at the bottom of the VirtualBox screen to do this while the machine is running. Once you have swapped discs, press F5 so iBoot can detect the new disc. It should now display Mac OS X Install on the boot selection. Go ahead and press Enter to boot this.
Step 3 - Install Snow Leopard
Now the Snow Leopard install will begin. Occasionally, I have found that it might kernel panic sometime during this install. Usually it happens during the boot process, but sometimes it happens later on. If it kernel panics before it tells you it's going to reboot the machine itself, then you have to go back to step 2.
I'm not going to go into the details of installing Snow Leopard. It's pretty straightforward and there are plenty of other guides out there. The basic process is to partition the drive, format it as Mac OS X Extended (Journaled), then tell it to use that disk to install to. I would recommend hitting customize and removing all the optional components before hitting install, but it shouldn't make any difference if you don't.
At the end of the install, when it tries to restart, it will kernel panic. This is a problem we will fix later by turning on EFI, but it won't matter here. It's already done and was going to restart anyways.
Step 4 - Boot into Snow Leopard using iBoot
After the install kernel panics on restart, it's time to swap discs back to iBoot and reset the machine. VirtualBox will probably tell you that the drive tray is locked, but you can ignore that because the machine is locked up anyways.
After you reboot the iBoot CD, you will now have two options: iBoot and whatever you called your Snow Leopard partition (I named mine Snow Leopard). Select the Snow Leopard one and boot it up.
Step 5 - Update to 10.6.8
After you have gone through the first boot process and created your user, you will need to download the
10.6.8 combo update. Then you need to run it and perform the update. When it tries to restart the machine, it will kernel panic again. This time, you can just turn the power off on the virtual machine.
Step 6 - Reconfigure VirtualBox for EFI
Go back to the VirtualBox settings for your Snow Leopard machine. In the system settings, check the Enable EFI box and save the settings. Now close VirtualBox.
Open a terminal window (e.g. konsole, gnome-terminal, Terminal, cmd.exe) and enter the following commands.
VBoxManage modifyvm "XYZ" --firmware efi64
VBoxManage setextradata "XYZ" VBoxInternal2/SmcDeviceKey "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "XYZ" VBoxInternal2/EfiGopMode 4
Replace XYZ with the name of your virtual machine. I called mine "Snow Leopard". The first one enables the 64-bit EFI firmware, in case you want to boot the 64-bit Snow Leopard kernel. You can still boot the 32-bit kernel using this firmware though.
The second line is hidden within the EFI of real macs as a form of DRM. If you don't have that data in the EFI, Snow Leopard won't boot with EFI.
The third line sets your graphics mode. There are 5 documented VirtualBox graphics modes for EFI. 0 = 640x480, 1 = 800x600, 2 = 1024x768, 3 = 1280x1024, and 4 = 1440x900. Since my monitor is running at 1900x1080, I'm using mode 4. You can leave this line out and it seems to default to 1024x768, which would be fine for most people.
Step 7 - Boot Snow Leopard using EFI
Now you can restart VirtualBox and boot Snow Leopard. You should remove the iBoot CD before you do this. You should now have a working Snow Leopard install in VirtualBox.
Final Notes
It should go without saying, but please buy the copy of Snow Leopard you install. It's only $30.
Updates should work perfectly since you're using a completely vanilla install, but I haven't tested this yet.
Sound is a little iffy. It works, but is not perfect. Sometimes sounds are silenced, sometimes crackly. You want perfect, use a real machine.
By default, Snow Leopard boots using the 32-bit kernel. I don't know if there are any benefits to booting the 64-bit kernel, but if you want to, you need to edit the /Library/Preferences/SystemConfiguration/com.apple.Boot.plist file. There is a Kernel Flags key. In the string value below it, you need to add arch=x86_64 and reboot. Now you will be using the 64-bit Snow Leopard kernel.