Home > create_macos_vm_install_dmg, Mac administration, macOS, Scripting, Virtualization, VMware, VMware ESXi > Building macOS installer disk images for virtual machines with create_macos_vm_install_dmg

Building macOS installer disk images for virtual machines with create_macos_vm_install_dmg

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

Screen Shot 2019 01 24 at 3 34 17 PM

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.

Screen Shot 2019 01 24 at 3 35 17 PM

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

Screen Shot 2019 01 24 at 3 40 14 PM

Screen Shot 2019 01 24 at 3 40 57 PM

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.

Screen Shot 2019 01 24 at 4 36 37 PM

4. In the Create a New Virtual Machine window, click on Use another disc or disc image…

Screen Shot 2019 01 24 at 4 36 43 PM

5. Select your macOS installer disk image file and click on the Open button.

Screen Shot 2019 01 24 at 4 37 20 PM

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.

Screen Shot 2019 01 24 at 4 37 26 PM

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

Screen Shot 2019 01 24 at 4 38 04 PM

7. In the Finish window, select Customize Settings if desired.

Screen Shot 2019 01 24 at 4 38 28 PM

Otherwise, click the Finish button.

Screen Shot 2019 01 24 at 4 38 29 PM

8. Save the VM file in a convenient location.

Screen Shot 2019 01 24 at 4 38 34 PM

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.

Screen Shot 2019 01 24 at 4 42 19 PM

Screen Shot 2019 01 24 at 4 42 28 PM

Screen Shot 2019 01 24 at 4 42 42 PM

Screen Shot 2019 01 24 at 9 34 06 PM

  1. Whitney Roberts
    February 3, 2019 at 10:40 pm

    Really appreciate you creating/updating and sharing the script – I’ve found it very helpful.

    To that point, I have found a few errors when it attempts to create an ISO file after the DMG has been completed. Please reply back to my e-mail address and I’ll send you some output so you can see what’s happening.

  2. mikeboss
    July 1, 2019 at 10:51 am

    VMware Fusion creates an image named “Temporary Installation Source Disk.dmg” inside the folder of the VM when drag’n drop the macOS installer app onto the “Install from disc or image” dialog (step 3 in your how-to).

  3. July 30, 2019 at 2:44 pm

    Do you expect this to work for Catalina?

  4. February 20, 2021 at 3:49 pm

    Just used it to create a Big Sur VM. Worked perfectly!

  1. No trackbacks yet.

Leave a comment