MacAdmin 101: Building Mac disk images using AutoDMG
As part of the process of deploying Macs, it is occasionally necessary to image or re-image them with a disk image containing the latest version of OS X or macOS. When I need to create disk images for use in my shop, I use an application named AutoDMG to generate them. AutoDMG is an open-source tool written by Per Olofsson which enables the creation of never-booted OS X or macOS images for deployment.
Why is creating a never-booted disk image important? When you boot a Mac for the first time, the OS will create a number of system-specific settings, temporary files and other associated system-specific data. Because this data is specific to an individual Mac, it doesn’t always transfer well to other Macs and may cause some quirky issues. By creating a never-booted disk image, you avoid the issue entirely because those files aren’t created as part of the image building process and consequently do not get transferred to Macs which are set up using the disk image.
When building an image using AutoDMG, the best approach is to build an image containing just the operating system and available updates included in the image. While you can also choose to include other software installers in your image build process, a lot of software installers won’t apply correctly to the image because the affected installers use scripts and other functionality which do not run properly when run as part of AutoDMG’s image creation process.
Because of this behavior, I recommend planning to install software as a post-imaging task as opposed to including it in your AutoDMG-generated disk image. For those interested, additional information on this topic is available from the Getting Started section of the AutoDMG wiki.
For more details on how AutoDMG can be used to build images, please see below the jump.
Before building a disk image using AutoDMG, you should prepare a convenient Mac or a virtual machine to act as an AutoDMG build machine. To accomplish this task:
a. Make sure the Mac or virtual machine is running the same version of OS X or macOS that you want to build a disk image of. If you want to build a disk image for OS X 10.11.6, your build Mac must be running 10.11.6.
b. Download and install the latest version of AutoDMG onto the Mac in question.
c. Download the installer for the relevant OS version onto the Mac in question.
Once you have completed the necessary preparations, see below for the process of building a disk image containing just the operating system and all of the currently available software updates.
1. Launch the AutoDMG application.
2. Drag and drop the relevant OS installer into AutoDMG’s source box.
AutoDMG may offer OS software updates to install as part of the image build process. At this point, you have the following options:
To skip including the available software updates in your image:
a. Uncheck the Apply Updates box.
To have the available software updates included in your image:
a. Check the Apply Updates box.
b. Click the Download button
c. Wait for all of the available updates to completely download.
d. Once all the available updates are downloaded, the Download button will appear as grayed-out.
For the purposes of this example, the available software updates are being included in the disk image.
3. Once the decision to include or not include updates has been made, click the Build button.
4. AutoDMG will suggest a name for your image based on the OS version and build number. Change the name as desired, as well as choosing a convenient location to save the disk image.
Note: By default, AutoDMG will include as part of the filename the correct file extension (.hfs.dmg) for DeployStudio.
5. When prompted, authenticate with an admin account to start the build.
6. AutoDMG will create a disk image and install the desired operating system on it.
Note: Even on a fast machine, this build process will take at least 10-15 minutes.
7. Once the image has been completed, a notification message will appear.
If needed, click the Reveal button to show the location of the newly-created disk image.
The complete process should look similar to what is shown below.
Note: The video has been edited to artificially reduce the amount of time it took to build a disk image. Run time of the pre-edited video was twenty-one minutes, forty seconds.