Installer Lab Notes

There is a way to get the OS installer into an installer package



Build installer package which installs Install OS X.app


Components:


  • Install 10.12.app (added to Scripts directory or installed somewhere on the filesystem.)
  • postinstall script


The command line tool to call is startosinstall



postinstall script would call startosinstall and install Install 10.12.app using the startosinstall tool.


Note: The startosinstall tool uses the same logic that the GUI app.




Usage: startosinstall --applicationpath <install os x.app path> --volume <target volume path>


Arguments
--volume, a path to the target volume.
--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.
--usage, prints this message.


Example: startosinstall --volume /Volumes/Untitled --applicationpath "/Applications/Install OS X.app"




New for Sierra:


An option to wait up to five minutes

Also an option to have the process send SIGUSR1 to a PID of your choice

- postinstall script invokes an app

- app displays a dialog (example - a five minute countdown) with an OK button

- OK button clicked, aborts remaining countdown and reboots



/path/to/startosinstall --rebootdelay time_in_seconds_here --pidtosignal specify_PID_here


If the installation is being run by an installer package's postinstall script, you can leverage installer's Bash variables. For example, $3 can be leveraged to have startosinstall use the installer package's target drive:


/path/to/startosinstall --volume $3 --applicationpath /path/to/install_macos.app




For additional packages, the following will work for macOS Sierra (will likely break in future OS releases):


If extra packages are needed, install them at the same time as Install OS X.app get installed. The OS installer will merge them, even if new directories are created first by the additional installer packages.



According to the engineer I spoke with, Apple has received numerous requests for the ability to install OS X and now macOS via an installer package. They are investigating this; the issue is being able to provide this in a safe and secure manner.


See complete list of session and lab notes here:

https://forums.developer.apple.com/message/142899