Sometimes, our work requires us to use different operating systems. And buying a separate machine for each OS that we need is simply not the best solution.

This article provides step by step guide on installing OS X Lion or OS X Mountain Lion on VirtualBox as guest OS. I am talking about running these OS legally, not about Hackintosh. So the host machine MUST be OS X since it’s the only way to run legal OS X.

I have used these steps to install OS X Mountain Lion (as guest) in my Mac mini running OS X Mavericks (as host). The VirtualBox version that I use is 4.3.6. As a bonus, I will add guides to install OS X Mavericks as guest OS too, but I haven’t tested running Mavericks as guest OS.

Disclaimer: This guide is provided as is, without any guarantee. Use this guide at your own risk.

First, I assume you already know about VirtualBox. It’s one of the best virtualization software from Oracle, and it’s legally free. If you haven’t heard about VirtualBox, you can start from here.

After you have VirtualBox installed. The next step is to create a new virtual machine. Follow the on screen instructions. Nothing special here. As a little tip, I use 20 GB virtual storage for Mountain Lion installation, but of course this will depend on what you are planning to do with the guest OS.

When you’re done with creating the virtual machine, do NOT run the machine yet. Go to the machine’s setting and choose System tab, find the setting for Chipset and make sure PIIX3 is selected there. Next, make sure EFI is enabled.

OS X Lion, Mountain Lion and Mavericks are downloadable from Mac App Store. Download the installation file of the OS that you need. It’s a big download (over 4 GB) so it will take a while. When the installation file is downloaded, it will ask you to proceed with installation, do NOT proceed. Instead, simply close the dialog.

After downloading installation file, we need to create bootable image for VirtualBox. There are various ways to create this, but I’m going to use a tool called iESD that I got from here. Credits to Edward Shaw for creating this excellent tool.

Open terminal.

Type gem install iesd to install iESD. If it doesn’t work, add sudo.

Next, if you want to install Lion or Mountain Lion, download this file and extract it to your user folder. For Mavericks, you do not need to download this file.

For OS X Lion, type:
iesd -i /Applications/Install\ Mac\ OS\ X\ -o Lion.dmg –install-kexts NullCPUPowerManagement.kext

For OS X Mountain Lion, type:
iesd -i /Applications/Install\ OS\ X\ Mountain\ -o Mountain\ Lion.dmg –install-kexts NullCPUPowerManagement.kext

For OS X Mavericks and your computer does not have ECC memory, type:
iesd -i /Applications/Install\ OS\ X\ -o Mavericks.dmg -t BaseSystem

If you want to install Mavericks as guest OS and your computer has ECC memory, type this instead:
iesd -i /Applications/Install\ OS\ X\ -o Mavericks.dmg -t BaseSystem –remove-kexts AppleTyMCEDriver.kext

Again, if the command didn’t work the first time, try using sudo.

You should have a dmg file for installing your guest OS now. Find it in your user folder. Now go back to VirtualBox and run the virtual machine. It will ask for startup file, point it to the dmg file you just created using iESD.

The actual trick here is creating the correct dmg file that will not cause kernel panic. I tried other methods of creating this bootable installer drive from other guide and ended up with AppleIntelCpuPowerManagementClient error upon booting my virtual machine. This new dmg file created using iESD solves the issue.

That’s it ! The following process is the usual steps of installing OS X.


Edit 27 Mar 2014 : This guide should work with VirtualBox 4.3.6 and 4.3.10. There is a report that it doesn’t work with VirtualBox 4.3.8 (thanks to papaiso and edsko).