A while back, I wrote a couple of scripts which built installers for Mac virtual machines:
However, Apple made some changes to the macOS installer starting in macOS Sierra 10.12.4 which broke the method I was using to build the installers. Recently though, I figured out that I could use Apple’s createinstallmedia tool to help me with building installers for Mac virtual machines again. After a substantial re-write, create_macos_vm_install_dmg is able to create bootable disk images for virtual machines running macOS Sierra, High Sierra and Mojave.
One change from the previous version of the create_macos_vm_install_dmg script is that the resulting installer no longer runs an automated installation. Instead, it will be necessary to follow the prompts to select the language and drive to install the OS onto. For more details, please see below the jump.
Downloading the script
The create_macos_vm_install_dmg script is available from the following location:
https://github.com/rtrouton/create_macos_vm_install_dmg
Once you have the script downloaded, run the create_macos_vm_install_dmg script with two arguments:
- The path to an Install macOS.app.
- A directory to store the completed disk image in.
Using the script
If you have a macOS Mojave 10.14.3 installer application available in your Mac’s /Applications directory, run this command:
/path/to/create_macos_vm_install_dmg.sh "/Applications/Install macOS Mojave.app" /path/to/output_directory
If you had chosen to not create the .iso file, this should produce a .dmg file inside the specified output directory named macOS_10143_installer.dmg. This disk image will install a stock factory install of macOS 10.14.3.
If you chose the option to create the additional .iso disk image, you should have two files inside the chosen directory: macOS_10143_installer.dmg and macOS_10143_installer.iso
Creating a VM with the OS installer disk image using VMware Fusion 11.x
1. Launch VMWare Fusion 11.x
2. In VMWare Fusion, select New… under the File menu to set up a new VM
3. In the Select the Installation method window, select Install from disc or image.
4. In the Create a New Virtual Machine window, click on Use another disc or disc image…
5. Select your macOS installer disk image file and click on the Open button.
6. You’ll be taken back to the Create a New Virtual Machine window. Verify that the disk image file you want is selected, then click the Continue button.
6. In the Choose Operating System window, set OS as appropriate then click the Continue button.
In this example, I’m setting it as follows:
Operating System: Apple OS X
Version: macOS 10.14
7. In the Finish window, select Customize Settings if desired.
Otherwise, click the Finish button.
8. Save the VM file in a convenient location.
The VM is now configured and set to use the macOS installer disk image. To install macOS, start the VM and then run through the normal installation process when prompted.