macOS 10.12.4 introduced a change that prevents the addition of third-party packages to the OS installer. This script uses the addition of a third-party installer package, so unfortunately this script cannot be used to generate 10.12.4 or later OS installers.
If you need to build a macOS 10.12.x VM, my recommendation at this point is to use the macOS 10.12.3 installer. Once the OS is installed, update to later versions of macOS Sierra as a post-installation task.
This script prepares customized OS X installer disk images for use with VMware Fusion and ESXi. It's adapted from the prepare_iso script created by Tim Sutton: https://github.com/timsutton/osx-vm-templates/tree/master/prepare_iso
1. This script and the associated support directory. This script and the support directory must be both stored in the same directory in order for the script to work properly.
2. A 10.7.x, 10.8.x, 10.9.x, 10.10.x, 10.11.x, or 10.12.x installer from Apple's Mac App Store.
Running the script:
Run the create_vmware_osx_install_dmg.sh script with two arguments: the path to an "Install OS X.app" or the InstallESD.dmg contained within, and an output directory.
If you have a 10.11.x El Capitan installer available, run this command:
sudo /path/to/create_vmware_osx_install_dmg.sh "/Applications/Install OS X El Capitan.app" /path/to/output_directory
This should produce a DMG file at output_directory that's named OSX_InstallESD_10.11_15A284.dmg. An MD5 checksum is printed at the end of the process.
What the script does:
1. Mounts the InstallESD.dmg using a shadow file, so the original DMG is left unchanged.
2. minstallconfig.xml is also copied, which is looked for by the installer environment's
rc.* files that first load with the system. This allows us to never actually modify the
BaseSystem.dmg and only drop in these extra files.
3. Additional installer packages can be added using a first boot package, which is added to
the OS X install by way of the OSInstall.collection file. The script is expecting the following:
A. That the first boot package is named "First Boot Package Install.pkg" (no quotes)
B. That the first boot package is stored in the support directory.
This first boot package can be generated by First Boot Package Install Generator.app, which will generate a
distribution-style flat package that can be used with 10.7 / 10.8 / 10.9 / 10.10 / 10.11 OS installs.
The instructions for using this tool to generate first boot packages are documented here:
4. If desired, a second disk image in .iso format can be generated for use with VMware ESXi
servers running on Apple hardware.
Once you have the customized DMG file created, you can choose it as an install disk image in VMware Fusion when creating virtual machines in VMware Fusion.
This script has been tested with Apple's 10.7.5, 10.8.5, 10.9.5, 10.10.5, 10.11.6, and 10.12.0 installers from the Mac App Store.
1. A pre-generated First Boot Package Install.pkg is stored in the support directory as a zip file named First_Boot_Package_Install.zip. Unzip the file before running the script. This first boot package will automatically install all available Apple software updates following the OS installation, but provide no other customization.
2. The 10.9.x disk images created with this method will not install a recovery partition into a VM. As a workaround, it appears that this can be addressed via using Per Olofsson’s Create Recovery Partition Installer to generate an installer that can install the missing recovery partition:
Create Recovery Partition Installer is available from here on GitHub:
Unfortunately, that installer would be too large to include as part of First Boot Package Install’s payload (available space is around 350 MBs, the Recovery Partition installer is around 485 MBs.)
In my testing, 10.7.x, 10.8.x, 10.10.x, 10.11.x and 10.12.x disk images will successfully install a recovery partition into the VM.