MacOS – How to install Mac OS X Lion in VirtualBox, or any other type of virtual machine

macosvirtualboxvirtualization

I purchased bought a license of Lion and heard that it supports virtual machine install.

I want to install Lion into my VirtualBoxVM on Lion on an iMac. How can I do this?

Best Answer

10.7 (Build 11A511) guest in VirtualBox 4.1 greater

Whilst end user forums are currently limited to Mac OS X Server, not updated for Lion, there is discussion of Lion (not always Lion Server) in that context.

With the most recent VirtualBox it is unnecessary to convert disk images; .dmg files are recognised.

Depending on your approach, you might see:

This version of Mac OS X is not supported on this platform!

— (example) — I saw that at least once.

Suggestion A: await media from Apple

I recommend this most strongly.

Await Apple's provision of Lion on a USB thumb drive. It may be something greater than 11A511 and if so, that greatness may be more suitable for use in virtual machines without the need to hack (see caution below).

Suggestion B: attempt upgrade from Snow Leopard within the virtual machine

In the virtual machine: install Snow Leopard then (honouring Apple's license for Snow Leopard as far as possible in this situation) use that installation for nothing other than an immediate upgrade to Lion. Attention please to agreements at Apple — Legal.

Suggestion C: hobby hacking with BaseSystem.dmg

  1. mount the hidden Apple_Boot Recovery HD

  2. use ditto or cp to set aside from that volume a copy of the following file:

    /Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg

  3. unmount Recovery HD

  4. use chflags with the nohidden keyword to remove the hidden flag from the copy that you set aside

  5. if you can boot the virtual machine from that .dmg then use Mac OS X Utilities to reinstall using the electronic software distribution downloaded from Apple

  6. if at step (5) you fail, discuss in Ask Different Chat.

Suggestion D: hobby hacking with InstallESD.dmg

At least one Apple Exchange user reports some success with a home-produced DVD burnt from an InstallESD.dmg

This may be most tempting and most likely to yield immediate success, of sorts, but in my estimation: hacking with this particular .dmg (ignoring Apple's .app for 11A511 as a whole) carries the greatest long-term risks.

Caution!

By using any .dmg out of context, as suggested above, you may be risking the integrity of your installation in ways that we can not predict. Please consider the following extract from Ask Different Chat:

With that caution in mind, my strongest recommendation is (A) to wait for Apple to provide USB flash media (scheduled for August 2011) with the assumption that it will be both (i) greater than 11A511 and (ii) more suitable for virtual machines and other environments that lacked broad support from Apple on the day of Lion's release.

(Bear in mind: day one was almost totally oriented to download-based upgrades from Snow Leopard.)