Install & Run Mac OS X 10.7 Lion in a Virtual Machine with VMWare

Mar 7, 2011 - 38 Comments

mac-os-x-10-7-lion-vmware

Update 9/14/2011: Installing Mac OS X Lion within a virtual machine is made significantly easier with VMWare Fusion 4. All you need to do is:

  • Go to the File menu and select “New”
  • Locate the “Install Mac OS X Lion.app” (here’s how to redownload Lion from the App Store) in your /Applications/ folder and drag that into the “New Virtual Machine Assistant” window
  • Choose Continue and select your settings, and boot the VM

Installation of Lion is extremely fast, and you are then able to boot and use your virtual OS X 10.7 install.

The older method is repeated below for posterity sake:

If you want to run Mac OS X 10.7 Lion Developer Preview but you don’t want to bother setting up another partition or upgrading your existing Mac OS X 10.6 installation, you can go with a third option: running Lion in a virtual machine with VMWare.

This is really only recommended for more technically inclined Mac OS X users. If you’re serious about Lion development, remember that virtual machines have their limitations, and you should probably just setup a dedicated partition to run the developer preview directly. Having a dedicated partition will ultimately perform better and the installation process is a lot easier than setting this up to run in VMware. Anyway, if you want to try out Lion in a VM, here’s what you’ll need:

Requirements to Install & Run Mac OS X 10.7 Lion in VMWare:

Regarding the RAM requirement, VMware and virtual machines in general perform best with a lot of RAM, if you plan on using them often on your Mac it’s highly recommended to upgrade to 8GB. With how cheap RAM is these days, I consider it an essential upgrade for power users. If you’re curious, you can read my review of 8GB RAM upgrade for a MacBook Pro where I detail the advantages of having a bunch of memory.

The Walkthrough:

Update: ObviousLogic.com seems to have disappeared from the face of the earth, here’s the walkthrough repeated below via Google Cache:

Everything ready? Then check out the great walkthrough from ObviousLogic: Installing Lion in VMware, it’s broken down into 12 steps that are easy to follow.

Installing Mac OS X Lion in VMware

Shhh! Don’t tell anyone.

Overview

Yay! The developer version of OS X Lion is out in the wild!!! Not going to say where I got it from, but I have it and I want to play with it!

But… Being ill-gotten and a pre-beta release, I really don’t want to install it on a hard drive and boot my iMac off of it. Who knows what crazy things could happen? Would suck if something was wrong with the file system (or a virus installed) and it wiped all attached drives!!! So, since I already use VMware Fusion for my OpenBSD web server, why not run Lion in a virtual machine!?

Issue 1. Only server versions of Mac OS X can be run in a virtual machine. Well there’s an easy way around that. Seems the system only checks for the existence of a single file, which can be created to appease the VM Gods.

Issue 2. Lion’s installation and boot process is a lot different and the VM doesn’t know what to make of it – booting from a disk image makes the VM cower into a corner and cry for help. Or just get outright hostile and tell you, “Not here, Jack!” But, as it turns out, there’s a way around that as well. Not as easy as the first obstacle, but possible nonetheless.

Step 1: Create a blank disk image.

Using Disk Utility, create and mount a new image with the following settings,

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

Step 2: Mount the Lion installer image.

The image I obtained mounts as ‘Mac OS X Install ESD’. If yours mounts as something different, then you will need to make any necessary changes to reflect that in the following steps.

Step 3: Mount the Base System image.

The Lion installer image contains a bunch of 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.

$ cd “/Volumes/Mac OS X Install ESD”
$ open BaseSystem.dmg

The volume will mount as ‘Mac OS X Base System’

Step 4: Copy the base system.

The entire contents of the base system needs to be copied to your installer image. The ‘Restore’ feature in Disk Utility works great for this. Once that is finished, you can eject the BaseSystem image, it is no longer needed.

Please note, if you chose to “Erase destination”, your installer image will now have the same name as the source, ‘Mac OS X Base System’. I rename mine back to ‘MyInstaller’.

Step 5: 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.

$ cp “/Volumes/Mac OS X Install ESD/kernelcache” /Volumes/MyInstaller/kernelcache

$ cd /Volumes/MyInstaller/Library/Preferences/SystemConfiguration/
$ sudo vi com.apple.Boot.plist

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

Kernel Cache
\kernelcache

Step 6: 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.

$ sudo rm /Volumes/MyInstaller/System/Installation/Packages

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

The copy (cp) command will take a few minutes; it’s copying a few gigabytes of data, so be patient.

Step 7: Flag the system as a server installation.

Again, 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; you can imitate a server installation simply by creating that file.

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

That’s it for the installation disk. Both installer images can be ejected.

Step 8: Create a virtual machine.

This shouldn’t be anything new to you, but I’ll go through each step anyway.

Open VMware Fusion and select “New…” from the File menu.
Click the “Continue without disc” button.
Select “Create a custom virtual machine” and then Continue.
Select ‘Operating System: Apple Mac OS X’ and ‘Version: Mac OS X Server 10.6 64-bit’, then click Continue.
Click the “Customize Settings” button, then name and save the new virtual machine.
Choose “CDs & DVDs” from Settings, then click “Use disc image” and select your installer image.
Choose “Hard disks” from Settings, 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.

Step 9: Replace the VMs NVRAM.

The default NVRAM will boot up previous OS X systems, but it will not boot up a Lion volume. I have a VM that I initially used as a Snow Leopard system. Booting into that system seems to have set the NVRAM so that it will know how to boot a Lion volume. Here is the NVRAM file from that VM. You can download it and use it in your VM.

nvram.zip

Download and uncompress the nvram file.
Locate your VM within the Finder, right click and select “Show Package Contents”.
Delete the current nvram file if one exists.
Copy the downloaded nvram file into the folder and rename it to match the name of your VM; mine is named, “Mac OS X 10.7”, so the nvram file would be renamed to “Mac OS X 10.7.nvram”
Now you should be able to run the VM and it will boot up to being the installation process.

Step 10: 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.

Step 11: Forcing the VM to boot from the CD.

VMware will not let you change the startup disk in the VMs 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”

This will then bring you to another menu where you choose which device to boot from. With “Mac OS X” selected, you can look at the ‘Device Path’ info on the right side of the screen to see the path to the default OS X boot device (this should be the hard disk). You can then move through the list to determine which device would be the CD to boot from. (The Pci or Scsi numbers will be different.) If you choose the wrong device the first time, you can just restart the VM and choose another until you get it right.

Step 12: Flag the new system as a server installation.

After the VM boots from the install disk again, run the Terminal from the Utilities menu.

I labeled my 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.


[ Image credit: r2×2 ]

.

Related articles:

Posted by: William Pearson in Mac OS, Tips & Tricks

38 Comments

» Comments RSS Feed

  1. Manu says:

    Step 7: Flag the system as a server installation.

    amazing :)

    thanx a lot, save my day

  2. […] atop an older 10.6 Snow Leopard installation. This is not supposed to work with 10.6 without a quirky configuration, but it does, and it’s easy to […]

  3. Calvin says:

    After finish installation, try out the new Lion OS.. OMG, damn slow.. damn slow.. Is there any extra setting on VMWare? My system running with Lion seems to be veryvery slow…
    Intel Core i3 530 2.93GHz
    4 GB DDR3 1333
    WD 500GB SATA HDD
    Gigabyte GA-H55M S2 Mobo
    I dont think this is a lousy system, but why slow when runing Lion??

  4. Gonzo says:

    I’m trying to install OS X Snow Leopard 10.6.3 on my VMWare Fusion 3.1.3 Mac running OS X Lion (10.7.1). Every time I create a VM using the Snow Leopard.iso image file I get an error stating “A virtual CPU has entered the shutdown state”. Cancel and OK are my only options. If I click OK, it keeps restarting saying same error message. If I click Cancel it stops and suspends the VM. I’ve read on other forums about editing the .vmx file to allow certain settings like:

    guestOS = “darwin-64”
    ich7m.present = “TRUE”
    smc.present = “FALSE”
    keyboard.vusb.enable = “TRUE”
    mouse.vusb.enable = “TRUE”
    monitor.virtual_exec = “hardware”
    monitor.virtual_mmu = “software”

    But I still get the same error message over and over! I’ve also tried other SL.iso images but still nothing! Someone please help. I’m getting frustrated. Any and all comments are appreciated. :)

  5. […] Recherche im Netz brachte sofort eine auf den ersten Blick einfache Möglichkeit hervor. OS X Daily beschreibt hier, dass die „Install OS X Lion.app“ als Installationsmedium genutzt werden kann. In der […]

  6. temp says:

    Hi,

    I’m stuck at step 5. I initially copied and pasted these commands and then I read something about curly quotes vs. straight quotes. I then redid step 5 by carefully typing the commands. Here is the result:

    Kernel Flags

    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    “com.apple.Boot.plist” 8L, 232C

    Now I don’t know what to do since it doesn’t seem to show the Kernel Cache
    \kernelcache

    What do I do now? Thanks in advance.

  7. osxjournalier says:

    Need some help please, I’m at step 10 but that’s when the VM shuts down saying it’s not server – what do I do ?

  8. Marcus says:

    Sarge,

    When you formatted your drive, did you partition it (not erase) and then name the partition OS X Lion HD? Once I did that I was able to run the touch “/Volumes/OS X Lion HD/System/Library/CoreServices/ServerVersion.plist” in the terminal and then it worked.

  9. sarge says:

    I have gone through this a few times and it has installed but I keep getting the:

    “The guest operating system is not Mac OS X Server.This virtual machine will power off.”

    I have done step 12 a few times with no luck. I have tried the nvram from Here: http://www.obviouslogic.com:8080/solutions/lion-vmware/

    Any Ideas

  10. Player1024 says:

    The installation remains forever at the stage where “Installing” shows up with a watermarked “X” on the window. The progress bar is alternating with white/blue bars (haven’t started to fill yet). The cd-rom and HDD activity is none.

    Any ideas?

    • Player1024 says:

      Lol, ok my bad, i was installing with ServerVersion.plist addition to the image created by the LionDiskMaker app.

      I retried now without the nvram above and so far is going well..its installing properly, not as a “re-install” . Ill keep you posted

  11. […] followed these instructions on OS X Daily which were for installing a developer release of Lion, but it worked for Snow Leopard as well. […]

  12. Irish Lad says:

    Well, I managed to follow this with the app store full version. Worked well. I didnt understand the sudo stuff and did it to the letter and all worked well. Great guide. Thanks to the author.

  13. Tom says:

    Note: For me, trying to install the official Lion Release via VMWare Fusion 3.1.3 on the Mac, the lion.rvram file was NOT accepted (it leads to a “Dictionary Error”). But if I simply did leave the VMware-created nvram file alone, booting of the Lion installer did work just fine. Hence, simply skip step 9 (I also made one little change to step 8: I chose the installer img directly instead of choosing “Create a custom virtual machine”). HTH.

  14. Finaluser says:

    I found a problem with Java installation.

    [solved]
    sudo rm /Volumes/Macintosh\ HD/System/Library/CoreServices/ServerVersion.plist

    Install Java
    http://support.apple.com/kb/index?page=answerlink&url=http%3A%2F%2Fsupport.apple.com%2Fkb%2FDL1421&answerid=16777216&src=support_site.downloads.search

    Restore “OS X Server” file
    sudo touch /Volumes/Macintosh\ HD/System/Library/CoreServices/ServerVersion.plist

  15. Will says:

    Anyone have trouble installing Java on the VM after doing this? I’m constantly told “Java for Mac OS X 10.7 can’t be installed on this disk. An error occurred while evaluating the JavaScript for the package.”

    This is with and with out VMWare tools installed.

  16. […] the beta, there were already steps on how to setup such a VM on a Mac or PC (including faking it to be the OS X Server), hopefully those steps have become a lot […]

  17. Jared Digby says:

    Can I get it pre done?

  18. Joseph says:

    This is my OSInstall.mpkg for OS X Lion DP 4: http://bit.ly/ikIQdx
    Here the AudioDriver: http://bit.ly/iehqRa

  19. Gabe Renfro says:

    im still getting the server version check issue. nothing has helped. also im on a lion host.

  20. Matt says:

    Anyone know the process to upgrade a vmware workstation VM of 10.6.7 to the DP4 version of Lion that just came out?

  21. Jon says:

    Is it possible to upgrade a VM of DP1 to DP2? or is it necessarily to repeat everything and install DP2 fresh?

  22. Brian says:

    Chris? Can you outline how to do that, please? Thanks!

  23. Chris says:

    was the OSInstall file the same only with the checks altered? If so I can do that myself.

  24. Brian says:

    The Rapidshare OSInstall.mpkg is gone. Can anyone please share?

  25. aviak says:

    use the same guide also for preview2:
    http://www.r2×2.com/users/lsb/weblog/b41f7/Howto_install_OSX_107_Lion_in_vmware.html

    before you install lion preview2 replace the OSInstall.mpkg
    with my modified: http://rapidshare.com/files/455434598/OSInstall.mpkg

    the orignal can be found in MyInstaller/System/Installation/Packages

    the files is invisible. so you have to use the terminal for replacing or make first invisible files visible in finder

  26. Adam says:

    Anybody know where I can find that nvram.zip file in step 9?

  27. dayzd says:

    @ngunez: You need to replace the copied and pasted quotation marks with straight ones – if you’re copying text from this page, you’re copying curly ones, which don’t work in terminal.

    Also, I’m with @JB. Are the Server Tools available anywhere?

  28. ngunez says:

    Hi,

    I’m stuck on on step 5. When executing the following command :
    cp “/Volumes/Mac OS X Install ESD/kernelcache” /Volumes/MyInstaller/kernelcache

    I get this :

    usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
    cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file … target_directory

    I tryed also with sudo, with -R still i’m not able to achieve this step. Help please.

  29. JB says:

    What do I need to copy to get server tools? On the install it says they aren’t available. Also, after installation, vmware tools breaks everything. The UI gets jacked up. Is there a fix? Also, how can I use gestures in the vm? My host os picks them up.

  30. Anonymous says:

    You can skip step 11 by installing the server components in step 10 or mounting the virtual machine running “/Library/Application\ Support/VMware\ Fusion/VMDKMounter.app/Contents/MacOS/vmware-vmdkMounter /path/to/vm/Lion.vmwarevm”

  31. Mike Reys says:

    One could also install it in VirtualBox… VB is free for just a little bit longer than 30 days ;-)

  32. Jonathan says:

    Nice to know but having a separate partition if not hard drive is the best way to test beta OS’s

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site