Category filter

How to sign macOS PKG files for deployment

Signing a PKG file is essential for security purposes. It ensures that the app is safe and trustable for use, and is free from malware. A signed PKG app file can be remotely deployed to the enterprise-ready macOS devices through the Hexnode UEM console. To sign macOS packages, you will require access to an Apple Developer account using which the certificates can be signed.

Two basic requirements that should be met to deploy macOS PKGs are:

  1. The .pkg file is built as a product archive.
  2. To distribute the macOS PKG as an enterprise app. The .pkg file should be signed with a Developer ID obtained from an Apple Developer Enterprise account. For all other apps to be distributed via the Mac App Store, the .pkg file is signed using the “Developer ID Installer” certificate, obtained from an Apple Developer account.


Apps are not natively available in .pkg file type. You have to repackage these installation files from their native format for package deployment into PKG files. Apps packaged in DMG/APP file formats can be easily converted to PKG format.

Signing a package is a multi-step process.
  1. Generate a signing request.
  2. Generate Developer ID Installer certificate.
  3. Sign the macOS PKG file.

Steps to generate a signing request

To generate a certificate, first you require a Certificate Signing Request (CSR) file.

  1. Open the “Keychain Access” program within your macOS device.
  2. Click on Keychain Access appearing on the top menu bar.
  3. Go to Certificate Assistant > Request a Certificate From a Certificate Authority.
  4. Add your email address in the User Email Address field and name in the Common Name field. Leave the CA Email Address field blank.
  5. Under the Request is option, click Saved to Disc.
  6. Click Continue.
  7. Specify the location on the device where the .csr file is to be saved and click Save.

The signing request will be saved to your machine in the specified location. This file is required to generate the “Developer ID Installer” certificate.

Steps to generate Developer ID Installer certificate

To generate the Developer ID certificate:

  1. Go to the Apple Developer Portal. Click on Accounts.
  2. Either create a new account or sign in using an existing one.
  3. Click on Certificates > IDs > Profiles.
  4. Click on Certificates + and select Developer ID Installer.
  5. Upload the Certificate Signing Request, which was downloaded in the step mentioned above.
  6. The Developer ID Installer certificate will be generated. Download the certificate and install it on your macOS device to sign the packages.

Steps to build and sign a macOS PKG file

To build and sign a macOS PKG file for a third-party app,

  1. Install the app on the device.
  2. Open Terminal.
  3. Build the .pkg file using the pkgbuild command.

    Here, the quoted text refers to the name of your certificate. The two arguments specify the location of the already installed .app file (/path_to_installed_app/ and the location of the newly generated .pkg file (/path_to_saved_package/packagename.pkg), respectively.
  4. Sign the .pkg file using the productbuild command.

    Here, the quoted text refers to the name of the certificate. The two arguments specify the location of the newly generated .pkg file (/path_to_saved_package/packagename.pkg) and the location of the signed .pkg file (/path_to_signed_pkg/signed.pkg), respectively.

Steps to sign macOS PKG files

To sign a macOS PKG file:

  1. Open “Keychain Access” within the macOS device and locate the certificate. The name of the certificate should be of the format: Developer ID Installer: Apple account name (serial number).
  2. Open “Terminal”. The command to sign the package would look something like this:

    Here, the quoted text following the –sign tag refers to the name of your certificate. The two arguments, following the name of the certificate, refer to the current location of the unsigned package (/Desktop/example.pkg) and the location of the signed package (/Desktop/signed-example.pkg), respectively.

The signed certificate gets stored in the destination path specified in the command. Now you can upload it to the app inventory.


Hexnode supports only signed distribution packages for package deployment. The pkg file should contain both the package info root file and the distribution root file during package validation. Uploading a signed flat package without these files causes the package validation to fail, and hence the app upload will be unsuccessful.

  • Managing Mac Devices