Skip to main content

Create a Package in Composer with a PostInstall Script

Create a Package in Composer with a Postinstall Script

Updated over 2 weeks ago

Description

This article provides steps to create a package with a postInstall script using Composer.

Creating a Package with a PostInstall Script

  1. Launch Composer.

  2. Click and drag the .pkg we are trying to build in the lower-left corner of Composer.

  3. Expand the Package under Sources.

  4. Right-click on Scripts and under Add Shell Script choose postinstall.

  5. Paste the script contents we would like to use.

    Note: Please be aware that the postinstall script should always start with:

    #!/bin/sh ## postinstall

    Example postInstall script we will utilize for this workflow:

    #!/bin/sh ## postinstall /usr/sbin/installer -pkg /tmp/JamfConnect.pkg -target /

  6. After pasting the script contents in Composer click on File > Compile Script.

    Note: Please ensure that the script complies successfully. If it does not Compile successfully, you will likely see this exclamation bubble in Composer. You can easily remedy this by changing line #1 in the script to: "#!/bin/zsh". Full example below:

    #!/bin/zsh ## postinstall /usr/sbin/installer -pkg /tmp/JamfConnect.pkg -target /

  7. After the script compiles successfully, please ensure that the Package has the appropriate root:wheel permissions.

  8. Build package by clicking Build as PKG in Composer.

Did this answer your question?