Starting with macOS Sierra, Apple moved the macOS Installer applications from being exclusively an App Store download to now being included in the regular Software Update catalogs. This means that it’s possible to download macOS installers, including those for macOS betas or hardware-specific macOS builds, using the command-line softwareupdate tool.
To assist with this task, Greg Neagle has written a Python script named installinstallmacos.py. installinstallmacos.py is designed to do the following:
1. Parse a specified Software Update feed.
2. Identify the listed products which appear to be macOS installers.
3. Display a menu of the available choices.
Once you’ve selected from the available options, the script does the following:
4. Creates a disk image and names it with the appropriate information for the specified macOS installer.
5. Mounts the disk image.
6. Downloads all the relevant packages from the Software Update feed for the specified macOS installer.
7. Installs the packages onto the disk image.
8. Unmounts the disk image.
9. Stores the disk image in the current working directory (this is likely going to be the logged-in user’s home folder.)
For more details, please see below the jump.
The script is available from the following location:
https://github.com/munki/macadmin-scripts/blob/master/installinstallmacos.py
Once you have it downloaded, please run the following command with root privileges to display the available options:
/path/to/installinstallmacos.py -h
You have the ability to use no options, one option, or combine multiple options when running the script. To run the script without any options selected, please run the command shown below with root privileges:
/path/to/installinstallmacos.py
By default, this will use the Software Update catalog specified in the script. As of February 27, 2018, the following macOS installer choices are displayed:
In this example, I’m selecting option 1 to download the standard macOS Installer application for macOS 10.13.3. Once an option has been selected, the script then runs through the rest of the actions described above and creates a disk image with the macOS Installer application stored in the Applications directory of the disk image.
Note: A content folder owned by root is also created, which was used by the script to store the various downloaded components. If desired, this folder may be discarded once the disk image has been created.
Using compression
If it’s desirable to save space, the script includes a –compress option. This option will create a compressed read-only disk image, with only the macOS Installer application stored on the disk image.
Update – 2-27-2018: Greg reached out to let me know that the –compress option’s primary function is to produce a disk image which is compatible with Munki and Imagr.
Both tools expect to find the macOS Installer application at the root level of a read-only disk image. Using the –compress option will allow installinstallmacos.py to generate a compatible disk image.
To use this option, please run the command shown below with root privileges:
/path/to/installinstallmacos.py --compress
In this example, I’m also selecting option 1 to download the standard macOS Installer application for macOS 10.13.3. The script then runs through its actions and creates a compressed disk image with only the macOS Installer application stored inside.
Using a different Software Update catalog
If it’s desirable to use a different Software Update catalog than the one specified in the script, the script includes a –catalogurl option. For example, you can specify the standard software catalog for macOS High Sierra using the URL shown below:
https://swscan.apple.com/content/catalogs/others/index-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog
To specify that you wanted to use the Software Update catalog above in place of the one specified in the script, you would run the command shown below with root privileges:
/path/to/installinstallmacos.py --catalogurl https://swscan.apple.com/content/catalogs/others/index-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog
Using a different working directory
If it’s desirable to store the disk image in a specific directory, the script includes a –workdir option. To run the script with a directory specified, please run the command shown below with root privileges:
/path/to/installinstallmacos.py --workdir /path/to/directory_name_goes_here
That will store both the disk image and the content directory in the directory specified in the command.