This article contains instructions for re-packaging / creating self-contained Apple Mac installer package (PKG) file for deployment purposes. The method outlined in the article is meant only for scenarios involving mass-deployment to multiple Mac computers wherein the deployment tool being used is not able to distribute DMG files as-is.
Please note that if you are intending to install Applixure Mac Agent only to a few computers, installation is done in non-unattended fashion, or your software distribution tool is able to use Applixure Mac Agent's installation DMG file as-is, Applixure recommends using the original Mac Agent installation disk image directly instead of following the method outlined in this article.
By default, installer for Applixure Mac Agent is provided as a disk image file, identifiable by the DMG extension. This DMG file must first be mounted on each target Mac computer, and after successful mounting the actual installer - in macOS installer's PKG format - must be run from the mounted volume at /Volumes/Applixure.
This Applixure Mac Agent installation PKG file cannot be taken out from the DMG volume, and distributed solely on its own due to its dependencies on other files that must be found from the /Volumes/Applixure path at the time of the installation.
However, some software deployment tools meant for Mac environments are unable to take the disk image file (DMG) as-is for distribution, mount it and run the content within the mounted volume on the target computers. These tools might operate in a fashion where they take only the PKG file and distribute it through distribution tools own delivery mechnism to the target computers, independent of the original DMG file from where it was read out.
For these reasons, an alternative solution is required for the distribution of Applixure Mac Agent using deployment tool that cannot handle raw DMG files natively, but can handle distribution of [self-contained] PKG files as such.
This article outlines one such method, wherein the whole original Applixure Mac Agent installation DMG file is effectively packaged inside another - "wrapper" - PKG installer file, and this newly created PKG file is then used as a distribution artifact for the distribution tool to satisfy the condition of having only one self-contained PKG file.
Creating wrapper PKG
To "wrap" Applixure -provided disk image file into self-contained PKG file that can be readily run through a mass-deployment tool, please first download deployment package creation script (MakeDeploymentPkg.zip) from the attachment at the end of this article. After the download, follow the instructions below.
First, make sure you have the Applixure Mac Agent installation DMG file available on your computer in some directory, so that the script can access it.
- Extract contents of the ZIP file to any suitable directory on your Mac computer.
- Open Terminal and change into directory you extracted the contents of the ZIP file:
- If needed, verify that deployment package creation script has proper permissions bits set:
chmod u+x ./makeDeployment.sh
- Run deployment package creation script, makeDeployment.sh, specifying the full path to the downloaded Mac Agent DMG as parameter for it:
If the script executes successfully and no errors are encountered, there should now be a new PKG file as a result in the same directory where the script is located.
This new PKG file encapsulates the whole original DMG file as a payload and contains the necessary pre- and post-installation scripts, so that during the time of PKG's execution the DMG file will be mounted on the target machine and the actual original PKG file will be run from it, ultimately installing the Applixure Mac Agent.
This self-contained PKG can now be added to the software deployment tool as it has no external dependencies on any other files or paths during execution time.
If digital code signature is required for the deployment PKG file, you can edit the deployment package creation script makeDeployment.sh before running it, and uncomment the productsign command invocation. In order for that command to succeed, you must additionally have a valid Mac Installer code signing certificate acquired from the Apple and installed to your Mac's keychain, and the <identity> part in the productsign's parameters replaced with the appropriate identity string matching the certificate.
Additionally, for macOS Catalina and newer macOS versions it may be additionally required that you notarize the resulting PKG file with your Apple ID. Please refer to Apple's documentation on notarization workflow on the command line for more information on how to notarize installation packages.