Creating customized OS X installer disk images for VMware Fusion
My preferred way to create VMs in VMware Fusion is by leveraging NetBoot and DeployStudio, but not all environments have access to NetBoot or DeployStudio. For those environments, there’s now a scripted way to create customized OS X 10.7.x or 10.8.x installer disk images for use with VMware Fusion. This allows the creation of OS X VMs in VMware Fusion that can configure themselves in an automated fashion without needing access to either NetBoot or server resources. See below the jump for the details.
The script below prepares a customized OS X installer disk image for use with VMware Fusion. It’s adapted from the prepare_iso script created by Tim Sutton.
Downloading the script and support files
Download a .zip archive containing all needed files from my GitHub repo.This will give you both the create_vmware_osx_install_dmg script and a directory named support which contains files that the script will be copying into the completed disk image.
Both the create_vmware_osx_install_dmg script and the support directory must be stored in the same directory in order for the script to work properly.
Once you have the .zip archive download and uncompressed, go into the support directory and unzip the First_Boot_Package_Install.zip file. First Boot Package Install.pkg is used by the script so it’ll need to be unzipped and prepared before running the script.
Configuring First Boot Package Install.pkg for use with the script
First Boot Package Install.pkg is an installer package that enables other packages to be installed at first boot. The script adds First Boot Package Install.pkg to the OS X installer and allows installer packages that can’t run in the OS X Installer environment to be be installed during the first boot of the VM.
NOTE: The customized OS X installer will have an upper limit of 350 MBs of available space for added packages. This is sufficient space for basic configuration, payload-free or bootstrapping packages, but it’s not a good idea to add Microsoft Office or similar large installers to this installer.
For details on how to configure First Boot Package Install.pkg, please see this post:
Running the script to create a customized OS X install .dmg file
Once you have First Boot Package Install.pkg configured with your packages, run the create_vmware_osx_install_dmg script with two arguments:
A. The path to an Install OS X [Mountain] Lion.app or the InstallESD.dmg contained within.
B. An directory to store the completed disk image in.
If you have a 10.8.4 Mountain Lion installer available, run this command:
sudo /path/to/create_vmware_osx_install_dmg.sh "/Applications/Install OS X Mountain Lion.app" /path/to/output_directory
This should produce a DMG file inside output_directory that’s named OSX_InstallESD_10.8.4_12E55.dmg. This DMG will install both OS X 10.8.4 and First Boot Package Install.pkg.
Creating a VM with the customized OS X install .dmg file
1. Launch VMWare Fusion 5.x
2. In VMWare Fusion, select New… under the File menu to set up a new VM
3. In the Create New Virtual Machine window, select Continue without disc.
4. In the Installation Media window, select Use operating system installation disc or image, then click on Choose a disc or disc image…
5. Select your customized OS X install disk image file
6. In the Choose Operating System window, set OS as appropriate. In this example, I’m setting it as follows:
Operating System: Apple Mac OS X
Version: Mac OS X 10.8 64-bit
7. In the Finish window, select Customize Settings if desired. Otherwise, click Finish.
8. Save the VM file in a convenient location.
The VM is now configured and set to use the customized OS X installer disk image. To install OS X and the packages included with First Boot Package Install.pkg, start the VM and then do nothing. The VM should begin automatically installing OS X on the VM’s boot drive, followed by the installation of First Boot Package Install.pkg.
Once the installation completes, the VM will then reboot.
On reboot, the login window will be stopped from loading while the packages included with First Boot Package Install.pkg are installed. Once the packages finish installing, the VM will reboot again.
After the second reboot, the VM should now be automatically configured with the desired applications and settings.