Category filter
How to convert APP to PKG for enterprise app distribution
Hexnode UEM provides an easy method for the distribution of enterprise applications on Mac devices. The apps pushed through Hexnode get silently installed in the device without any user intervention. Applications that run on macOS come in various formats like ‘.app’, ‘.dmg’, and ‘.pkg’. It is recommended to convert APP to PKG format.
One way to distribute apps in ‘.app’ format is by publishing them to the App Store and manually downloading them on all user devices. This process can be made easier by converting it to .pkg format and deploying it over the network or by placing it in a shared folder. For the same reason, Hexnode UEM only supports the distribution of applications that are in the PKG/MPKG/DMG format. Distribution of application in the PKG format helps to reduce steps and save the time taken for installation.
Packages are folders that contain numerous files. However, they appear as a single file to the user. They come as files with a ‘.pkg’ extension. A double click on the PKG file launches the installer GUI. These installers can do things that the drag-and-drop installers (for dmg files) cannot, like installing system services and specifying the install location. The PKG file can be deleted once the installation is complete.
Steps to convert ‘.app’ file to ‘.pkg’ file using Terminal
- Open Terminal.
- Use the command given below to build a package.
1productbuild --component "component-path" "install-path" "/path/to/product-output-path/packagename.pkg"
The productbuild command is used to build product archive for the OS X Installer or the Mac App Store. The three arguments specify the location of the already installed .app file (/component-path/filename.app), the path to the location where the component should be installed when the package is installed (install-path) and the desired location of the newly generated .pkg file (/product-output-path/packagename.pkg), respectively.
- Wait for the build to complete.
123productbuild: Adding component at 'component-path'/filename.appproductbuild: Wrote product to '/path/to/product-output-path'/packagename.pkgproductbuild: Supported OS versions: [10.14, )
A similar message is displayed on the Terminal indicating the successful creation of the package file.
- Proceed to the destination path to find the package file.
For example, the below code builds a package named “packagename.pkg” using the component located at “/Applications/filename.app” and installs it to the “/Applications” folder. The output package is saved to “Downloads/packagename.pkg”.
1 |
productbuild --component "/Applications/filename.app" "/Applications" "Downloads/packagename.pkg" |
After the build is completed, this message is displayed on Terminal:
1 2 3 |
productbuild: Adding component at /Applications/filename.app productbuild: Wrote product to Downloads/packagename.pkg productbuild: Supported OS versions: [10.14, ) |
Signing a PKG file is essential for security purposes, to ensure that the app is safe and trustable for use and is free from malware. Check out how to sign macOS pkg files for deployment.
And we are done! A package can be distributed via email, FTP, the cloud, thumb drives, and so on. Now you can go ahead and start distributing the packages.