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\ Lion.app -o Lion.dmg –install-kexts NullCPUPowerManagement.kext
For OS X Mountain Lion, type:
iesd -i /Applications/Install\ OS\ X\ Mountain\ Lion.app -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\ Mavericks.app -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\ Mavericks.app -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).
As mdl says although you can just format the disk in the Disk Utility from the Utilities Menu with no restart required.
Managed to get Yosemite running on Mavericks but by crikey it was painful.
The installer said “17 minutes to go” – took 3 hours.
Late 2012 Mac Mini with 4GB (now needing a substantial upgrade).
Please forgive me but I just jumped in to try the thing out on my own, without all the excellent directions you provide.. I installed 10.6 from a standard installer disk on a machine running 10.7. I also used disk utility to create a single named partiton on the virtual disk and the installation went fine. Problem is after the usual reboot, that screen comes up asking to identify the keyhboard by pressing a specific key. It can’t. It just keeps pinwheeling. Aparently the simulation doesn’t see the keyboard. What can I do to fix this?
Unfortunately it is not working for Mavericks 10.9.5 on VBox 4.3.18. The boot gets to “hfs: mounted OS X Base System on device root_device” and halts. No error, but it sticks there forever.
Awesome instructions. Just out of curiosity, does audio in “Intel HD Audio” mode work in the VM?
I followed the instructions in an attempt to install Mavericks as a guest on my Mavericks host OS. I mistakenly started executing the last terminal command, for ECC memory. I realized that I was doing this and killed the command.
When I tried executing the non-ECC memory terminal command, I received this error:
==> Mounting /Applications/Install OS X Mavericks.app/Contents/SharedSupport/Ins
Failed during: /usr/bin/env hdiutil attach -quiet -nobrowse -noverify -mountpoint /var/folders/dm/39vxklpn5hz660tlzxccppd00000gn/T/d20140804-2841-3uiowj /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg
I tried the ECC memory terminal command again, but the same message appears.
Now I regret cutting the execution of that first command. What do I do to rectify this?
Worked for me in running ML guest on Virtual Box 4.3.12 on MacBook Air Mid 2013 13″ i5 Haswell. VB was installed on a ML 10.8.5
After running iesd to get the new dmg, the installer was not booting till I updated the cpuidset.
I too had to erase the disk (as suggested by @mdl) for the installation to proceed
I initially changed the cpuidset to the one mentioned in the ticket – https://www.virtualbox.org/ticket/12802 , but after a successful installation, the VM was running very slow. I then tried the cpuid mentioned by @Frans and that fixed the performance issue
Maverick 10.9.3
VB 4.3.12
All instructions worked fine above.
However booting in VB was a problem but there is a ticket: https://www.virtualbox.org/ticket/12802
Once loaded follow mdl’s fix for showing up the disk by erasing. I didnt have to restart for it to show though.
Verified this on a mac book air and pro.
Using iESD is very (very, very) frustrating. It requires ruby 1.9.2. And getting ruby 1.9.2 installed on Mountain Lion must be the hardest thing to do on a computer nowadays. No matter if I used a superuser account, done everything via sudo, etc, first of all rvm failed no matter how hard I tried it to work. Then I tried some GUI called jewelry or something, and it also failed with an error (a Mac GUI failing with an error, this is the first time I see this in maybe a decade). Yes, I’ve Xcode command line tools installed, and all requisites installed. But ruby isn’t Mac-friendly. I’m sorry, I’ll try another approach. Very frustrating.
Getting IESD running on my Mountain Lion 10.8.5 took a lot of effort for me too (but it was worth it). All these were done as an administrator
a) Update XCode to 4.6.3
b) Install homebrew
ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
c) Disable my macports installation (I guess not everyone uses this)
sudo mv /opt/local ~/macports
d) Install rvm
curl -L https://get.rvm.io | bash -s stable –autolibs=enable
e) Configure rvm in my bash profile
echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm” # Load RVM function’ >> ~/.bash_profile
f) Source my updated bash profile
source ~/.bash_profile
g) Verify rvm is running by running the command
type rvm | head -1
Output should be – (rvm is a function)
h) Update rvm
rvm get stable –autolibs=enable
i) Install ruby 1.9.3
rvm install 1.9.3 –with-gcc=clang
j) and then finally Install iesd
gem install iesd
Easier than installing RVM is just using Homebrew to install Ruby:
1. Install Homebrew (visit http://brew.sh/#install for the current method)
2. Once installed,
brew install ruby
to grab the current stable Ruby (v2.1.5 as of this writing)3. You may need to adjust your
$PATH
to ensure that the Homebrew-installed Ruby takes precedence over the system-installed one; placing this in your.bash_profile
will do the trick:export PATH="/usr/local/bin:$PATH"
Many thanks. Worked a treat for Mountain Lion on Mavericks.
Unfortunately doesn’t work, always fails at the same point :(
Running from OS X 10.9.3, trying to make Mountain Lion install.
USER-mbp:~ USER$ sudo iesd -i osx108.dmg -o ~/Desktop/osx108.dmg –install-extension NullCPUPowerManagement.kext
==> Mounting /Users/USER/osx108.dmg
Mounted: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-f5ggb7
==> Detecting /Users/USER/osx108.dmg
Detected: InstallESD
==> Unmounting /Users/USER/osx108.dmg
Unmounted: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-f5ggb7
==> Mounting /Users/USER/osx108.dmg
Mounted: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i
==> Mounting /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i/BaseSystem.dmg
Mounted: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-10bkmcj/d20140616-81879-tyviaj
==> Copying /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i/mach_kernel
Copied: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-10bkmcj/d20140616-81879-tyviaj/mach_kernel
==> Installing Extensions
Installed: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-10bkmcj/d20140616-81879-tyviaj/System/Library/Extensions/NullCPUPowerManagement.kext
==> Updating Kextcache
Updated: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-10bkmcj/d20140616-81879-tyviaj/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache
==> Unmounting /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i/BaseSystem.dmg
Unmounted: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-10bkmcj/d20140616-81879-tyviaj
==> Merging /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-10bkmcj/BaseSystem.dmg.shadow
Merged: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-87c23d/BaseSystem.dmg
mv: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i/BaseSystem.dmg: No space left on device
Failed during: /usr/bin/env mv /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-87c23d/BaseSystem.dmg /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i/BaseSystem.dmg
Error: Directory not empty – /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20140616-81879-j9uqqn/d20140616-81879-1l2ms1i/.Spotlight-V100/Store-V2/626BD683-EAAC-48EC-8BA4-DD6F4C9DB526
USER-mbp:~ USER$
It seems the iesd gem has a new syntax for pointing out kexts: –install-kext is now –install-extension, apparently.
I managed to get this working well running Mountain Lion inside Mavericks.
Lion, however, I can not get to work: for some reason, it doesn’t seem to find the drives, it just boots into some efiboot shell… Any ideas? I managed to record a video of the boot up sequence: it flashes the following for a brief second:
“Found HFS+
FSW Error: InstallMultipleProtocolInterfaces returned 2”
Then goes to the “Loading kernel cache” stage, and finally ends up at the efiboot shell prompt.
Thanks for sharing !
Thx for the great tutorial. Used this to install Mavericks on VB 4.3.10.
On boot, the OSX installer got stuck on “hfs mounted on device root_device”.
This fixed it:
VBoxManage modifyvm –cpuidset 1 000206a7 02100800 1fbae3bf bfebfbff
Credits: Donk@http://www.insanelymac.com/forum/topic/294504-virtualbox-sllml-and-core-i7-hasweel/?p=1975352
Unfortunately that command fails:
VBoxManage: error: Could not find a registered machine named ‘–cpuidset’
Following up to my own comment, you have to run the command from the same account as created the VM’s. I had run it as sudo. It works if you run it normally.
I got an error when trying to make this .dmp file …sh: 1: /usr/bin/uname: not found…help!!! thanks
and I am using VB version 4.2.10 >_<
Got Mavericks on VB 4.3.8 installed and working but how do you install the guessAdditions?
Sorry I mean 4.3.10
Until today, there is no Guest Additions for OS X clients.
Sorry to be answering my own question, but this appears to be a regression in VirtualBox 4.3.8 (see also https://github.com/boot2docker/boot2docker/issues/260). Upgrading to 4.3.10 (just released) seems to fix the issue.
Thanks for sharing your experience. So I take it as you have Lion installed in 4.3.10 now?
Mountain Lion actually, but yes.
There is a typo in the line for Lion, which is why it wasn’t working for one of the other commenters probably:
iesd -i /Applications/Install\ OS\ X\ Lion.app -o Lion.dmg –install-kexts NullCPUPowerManagement.kext
should be
iesd -i /Applications/Install\ Mac\ OS\ X\ Lion.app -o Lion.dmg –install-kexts NullCPUPowerManagement.kext
(“Mac\ ” missing). Unfortunately, however, it’s not working for me :( Host OS is Mavericks, on a mac mini, VirtualBox 4.3.8 with extension pack installed. Created the virtual machine as per instructions (PIIX chipset or nothing will happen, EFI or it won’t find the boot medium). Created the .dmg as instructed, tried with both Lion and Mountain Lion. But sadly both fail with a kernel panic, almost immediately.
For Lion:
http://s30.postimg.org/48ho0hs9d/Screen_Shot_2014_03_26_at_8_39_23_PM.png
For Mountain Lion:
http://s15.postimg.org/grry60f23/Screen_Shot_2014_03_26_at_8_40_03_PM.png
Any suggestions would be appreciated!
problem on rebooting about rebuilding triggers
When I type in the command iesd -i /Applications/Install\ OS\ X\ Lion.app -o Lion.dmg –install-kexts NullCPUPowerManagement.kext I get a message saying “input file does not exist”
The terminal see the Install\ OS\ X\ Lion.app file as a folder
Why is doing this?
1. Have you downloaded iESD?
2. Have you downloaded OS X Lion from Mac App Store and make sure the installer file is still in your Applications folder?
Yes and Yes
I have downloaded and installed ‘iesd’ using the gem install command as explained. “Install Lion OS X Lion.app” is in the /Applications folder… however “Install Lion OS X Lion.app” is seen as a folder not as a file … for this reason I think iesd says “input file does not exist”
I wonder if I should try an older version of iesd?!
GOT IT!
The correct syntax is:
iesd -t BaseSystem -i /Applications/Install\ Mac\ OS\ X\ Lion.app/Contents/SharedSupport/InstallESD.dmg -o Lion.dmg –install-kexts /Volumes/Untitled/NullCPUPowerManagement.kext
Thanks for updating your progress. I have tried my syntax with Mountain Lion and there was no problem. Not sure why OS X Lion would require different syntax.
The syntax for Mavericks is correct however I am still getting kernel panic when I install both Lion or Mavericks on VB 4.3.8 on Ubuntu 12.04
The one I personally installed was Mountain Lion (guest) on Mavericks (host) and it worked well.
OK… Latest update
With the dmg files created following the instructions on this post I was able to install Lion and Mavericks on VB 4.3.8 on Mavericks, but not on Ubuntu 12.04.
When I get to the screen that asks me which hard drive to install on, the list is empty. Have you run into that?
There should be a button next to the empty list so we can choose our freshly-made dmg file.
I see the same thing as James – https://db.tt/SkCt7fVo
I was able to solve this is my own. In the VM, I chose Disk Utility from OS X Utilities and erased the drive. Then I restarted and the disk showed up as an option to install to.