Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2021 14:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Package Build Script - Signed Distribution Package
echo "Supply the package name and version: <pkgname> <version>"
# get date for package name
myDate=`date +%Y%m%d`
# Name of the package.
# Once installed the identifier is used as the filename for a receipt files in /var/db/receipts/.
# Package version number.
# Remove any unwanted .DS_Store files.
find ROOT/ -name '*.DS_Store' -type f -delete
find scripts/ -name '*.DS_Store' -type f -delete
# Build package.
/usr/bin/pkgbuild \
--root ROOT/ \
--scripts scripts/ \
--identifier "$IDENTIFIER" \
--version "$VERSION" \
# Build Distribution Package
/usr/bin/productbuild \
--package "Output/$NAME-$VERSION-$myDate.pkg" \
productsign --sign '<INSERT YOUR CERTIFICATE NAME>' "Output/$NAME-$VERSION-$myDate-dist.pkg" "Output/$NAME-$VERSION-$myDate-dist-signed.pkg"
Copy link

You need the Name of your signing certificate. You can find this by looking in Keychain Access and copying the name of the certificate. Paste that on line 30 above where it says "".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment