Using the macOS High Sierra OS installer’s startosinstall tool to install additional packages as post-upgrade tasks
Starting with macOS 10.12.4, Apple locked down the macOS installer to make it impossible to add non-Apple installer packages directly to the macOS Install .app without using NetInstall. However, there is a way to configure the macOS High Sierra OS installer to install additional packages as a post-upgrade task. For more details, please see below the jump.
Apple includes a command line tool named startosinstall as part of the macOS High Sierra OS installer application, inside Install macOS High Sierra.app/Contents/Resources.
This tool has several options, including a –installpackage option which allows one or more packages stored on the Mac in question to be installed following the upgrade.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
computername:~ username$ "/path/to/Install macOS High Sierra.app/Contents/Resources/startosinstall" –usage | |
Usage: startosinstall | |
Arguments | |
–applicationpath, a path to copy of the OS installer application to start the install with. | |
–license, prints the user license agreement only. | |
–agreetolicense, agree to license the license you printed with –license. | |
–rebootdelay, how long to delay the reboot at the end of preparing. This delay is in seconds and has a maximum of 300 (5 minutes). | |
–pidtosignal, Specify a PID to which to send SIGUSR1 upon completion of the prepare phase. To bypass "rebootdelay" send SIGUSR1 back to startosinstall. | |
–converttoapfs, specify either YES or NO on if you wish to convert to APFS. | |
–installpackage, the path of a package to install after the OS installation is complete; this option can be specified multiple times. | |
–usage, prints this message. | |
Example: startosinstall –converttoapfs YES | |
computername:~ username$ |
Something to be aware of is that if you want to add any additional packages, they must all be signed or unsigned distribution-style flat packages. This is a requirement that Apple first introduced for the OS X Yosemite installer and it still applies to macOS High Sierra. You can convert a component flat package to be a distribution-style flat packages by running the command below:
productbuild –package /path/to/component.pkg /path/to/distribution.pkg
To run an automated upgrade to macOS High Sierra, where two distribution-style flat packages stored in /Users/Shared are installed following the upgrade, please run the command shown below with root privileges:
/Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall --applicationpath /Applications/Install\ macOS\ High\ Sierra.app --agreetolicense --installpackage /Users/Shared/installer_one.pkg --installpackage /Users/Shared/installer_two.pkg --nointeraction
Note: The –nointeraction flag is an undocumented option to automate the installation process from the command line without additional requiring actions by the logged-in user.
To show what the process looks like when upgrading from macOS Sierra, please see below for a video. In this example, I’m installing the latest Office 2016 installer following the upgrade.
Note: The video has been edited to artificially reduce the amount of time the upgrade and post-upgrade installation process takes to run. Run time of the pre-edited video was 32 minutes 57 seconds.
Great guide!
Thank You 😀
Will adding a third party package work if you use the –eraseinstall option?
I was thinking the same thing. The package to be installed afterwards must be copied to the installer disk image, though I haven’t tried it. I was hoping to use the erase disk flag but apparently it only works on an AFPS drive. I’m installing on Fusion drives.
This was very helpful for me
slight typo in the command above to create a distribution package. it should read “–package” with 2 dashes, instead of “-package” with one dash as written above.