Select Page

I’ve not yet "upgraded" my 17 inch MacBook Pro (my "main machine" as I call it) to Lion. There’s a number of reasons for this – too many to go into here, but I think it’s probably a case of if it ain’t broke then don’t fix it. I know I’m going to have to do it sooner or later as at some point they’ll be some software that I can’t live without that will only work on Lion. But for the moment my Lion experience is limited to my 13 inch MacBook which was upgraded the day that the new OS was launched.

The MacBook is 4 years old and runs like a lame dog. It always has done to be honest. There’s no way I could seriously use Final Cut or Photoshop on it for example. It does have VMWare Fusion installed but if I want to run my Vista VM or my Windows 7 VM, forget it. I installed Lion on it, "because I’m an Apple Geek" and because I didn’t want to be left out. I’d already gone on record at the MacBites Live event when Lion was demo’d and also on MacBites episode 51 as saying that there was nothing in it for me.

However, it’s always handy to have an installation of Lion to tinker with plus, as a Podcast Host, I regularly have to check out some piece of software which no doubt will come with a 30-day trial at the end of which I’ll have to either buy it or remove it. So I decided the way forward was to create a Lion VM. The problem was that VMWare Fusion 3 (version 4 has just been released but at the time of writing I haven’t bought it) doesn’t support Lion as a Guest OS. Although Parallels 7 does allow you to create a VM with Lion as the Guest OS, it is activated and costs £35 a seat and although you are supposed to be able to convert Fusion VM’s to Parallels (I have 7 VM’s), I’m never quite sure how well that works.

Well I was in luck – it turns out that you can create a VM with Lion as the Guest OS using Fusion 3. However, there was a lot of terminal hacking. Here’s how to do it…

Create a blank disk image


Using Disk Utility, create a new image. To do this, select File > New > Blank Disk Image.

Name: MyInstaller – you can name it whatever you want, but be sure to modify the steps below accordingly.
Size: 5 GB (tip – use the Custom option)
Format: Mac OS X Extended
Encryption: none
Partitions: Single partition – Apple Partition Map
Image Format: DVD/CD master

Save the image – in this example I’ve saved it as "LionInstaller" in my Documents folder. The file will have a CDR extension

Once the new disk image is created, it should automatically be mounted and you should see "MyInstaller" listed in the Finder sidebar. If it does not automatically mount, simply find the CDR file and double-click it.

Mount the Lion installer image


To do this, locate the file “Install Mac OS X” (this is the file that you should have downloaded from the Mac App Store when you bought Lion), right click on it and select “Show Package Contents”. Open the "Contents" folder and then the "SharedSupport" folder and double-click on InstallESD.dmg to mount the image. The mounted image should display as ‘Mac OS X Install ESD’ in the Finder Sidebar.

Mount the Base System image

The Lion installer image contains some hidden files. To get to them you’ll need to run the Terminal application. One of these hidden files is BaseSystem.dmg which is used to boot the system.

Open the Terminal application and at the $ prompt, type: cd "/Volumes/Mac OS X Install ESD"

Press Enter and at the next $ prompt type: open BaseSystem.dmg

The volume will mount as "Mac OS X Base System"

Copy the base system


Ensure that your installer image created in step 1 is mounted (if it isn’t find the file LionInstaller.cdr and double click it) because the entire contents of the base system needs to be copied to your installer image.

I recommend using the Restore feature in Disk Utility.

Click any drive in the Disk Utility Sidebar (1)

Click the Restore button (2)

Drag the "Mac OS X Base System" to the "Source" field (3)

Drag "MyInstaller" to the Destination field (4)

Click the Restore button at the bottom right (5)

Be aware that if you chose to "Erase destination", your installer image will now have the same name as the source, Mac OS X Base System. If so, rename it back to ‘MyInstaller’.

Once that is finished, you can eject the BaseSystem image as it is no longer needed

Setup the ‘kernelcache’ file

First the file needs to be copied from the Lion installer image to your installer image, then the boot configuration file updated to specify the location of the file. All these operations are performed via the Terminal using the following commands:

$ cp "/Volumes/Mac OS X Install ESD/kernelcache" /Volumes/MyInstaller/kernelcache
$ cd /Volumes/MyInstaller/Library/Preferences/SystemConfiguration/
$ sudo vi

Make sure the boot file contains at least the following key/value to specify the location of the kernelcache file:

Kernel Cache

To do this, navigate to the Library/Preferences/SystemConfiguration folder on the MyInstaller volume and open the file with a text editor. If necessary copy the 2 lines:

<key>Kernel Flags</key>

and paste immediately below. Then amend the copied lines to:

<key>Kernel Cache</key>

Save and close the file

Copy the installation Packages

Before the packages can be copied from the Lion installer image, there’s a file on your installer image that needs to be deleted. Use the Terminal to do this and be aware that this operation might take a few minutes because it’s copying several gigabytes of data.

$ sudo rm /Volumes/MyInstaller/System/Installation/Packages
$ sudo cp -R "/Volumes/Mac OS X Install ESD/Packages" /Volumes/MyInstaller/System/Installation/Packages

Flag the system as a server installation

In order to boot an OS X volume in VMware, it needs to be a server. The system checks for the existence of a file in a specific location and you can "fake" a server installation simply by creating that file using the following Terminal commands:

$ cd /Volumes/MyInstaller/System/Library/CoreServices
$ sudo touch ServerVersion.plist

Both installer images can be ejected.

Create a virtual machine – 1


Open VMware Fusion and select “New…” from the File menu.

Click the “Continue without disc” button.

Create a virtual machine – 2


Select “Create a custom virtual machine” and click Continue.

Create a virtual machine – 3


Select ‘Operating System: Apple Mac OS X’ and ‘Version: Mac OS X Server 10.6 64-bit’ and click Continue

Create a virtual machine – 4


Click the “Customize Settings” button and name and save the new virtual machine – my VM is saved as "LionTest"

Create a virtual machine – 5


From the Settings menu in VWMare Fusion, select “CDs & DVDs

Create a virtual machine – 6


Click “Use disc image” and select your installer image (the one created in Step 1)

Create a virtual machine – 7


From the Settings menu, select “Hard Disks

Create a virtual machine – 8


Deselect “Split into 2 GB files” for the pre-created hard drive and click Apply. Feel free to make any other changes to the settings with one caveat, you must use a SCSI hard disk; IDE drives are not recognized by the installer after it boots. Also, if the hard disk is going to be used as a boot disk, it cannot be split into separate 2 GB files, so make sure to deselect that option when the HD is created.

Replace the Virtual Machine’s NVRAM

VMWare Fusion’s default NVRAM will boot up previous OS X systems, but it will not boot up a Lion volume. The original article where I found these instructions had a link to an NVRAM file. In case that file disappears, I’ve linked to my own copy that you can download here:

Download and uncompress the NVRAM file.

Locate your VM within the Finder (mine is in my Documents folder and is called LionTest), right click and select “Show Package Contents”.

Delete the current nvram file if one exists – the file will have an .nvram extension

Copy the uncompressed and downloaded nvram file into the folder and rename it to match the name of your Virtual Machine (e.g. LionTest.nvram)

Now you should be able to run the VM and it will boot up and start the Lion installation process.

Installing Lion

After the installation disk boots up, the first thing you should do is run Disk Utility and format the hard drive. All the norms apply; GUID partition map, Mac OS X Extended (Journaled) format, etc. When done, quit to return to the installer.

Continue with the installation. When the installation is complete, it will attempt to reboot the VM using the freshly installed OS on the hard disk. It won’t boot, because it’s not a server installation.

Forcing the VM to boot from the CD

VMware will not let you change the startup disk in the VM’s settings, so you’ll have to force a change while the VM is running. Start the VM. As soon as you see the VMWare splash screen, hit the Escape key. This will bring you to a boot menu, select “Boot Manager”

Flag the new system as a server installation

After the VM boots from the install disk again, run the Terminal. I labeled my virtual HD, “OS X Lion HD” when I initialized it, so I would enter the following to ‘touch’ the system:

# touch "/Volumes/OS X Lion HD/System/Library/CoreServices/ServerVersion.plist"

Now you can quit the Terminal, choose Startup Disk from the Utilities menu and restart from the hard disk