Category filter
How to convert DMG to PKG Mac App for distribution
DMG files or Disk Image files are used to install software but can contain any type of files, not just app or installation files. They are usually used by macOS software installers downloaded from the internet.
PKG files are macOS installation packages which contain installer scripts and compressed installation files that are used to install Mac software applications on a user hard drive.
The issue with DMG files is that it needs to be mounted as a virtual disk to push apps, whereas PKG files can be directly installed. So, in order to push an enterprise app, Hexnode prefers PKG files. So, we need to create PKG files from DMG files to push it through Hexnode. It’s a rather simple process that can be done with the help of the Terminal.
Terminal can create PKG files from dmg files and then the PKG files can be distributed via Hexnode as enterprise apps.
PKG files can only be created from DMG files containing applications by using terminal.
Steps to convert macOS DMG files to PKG files.
- Go to the folder that contains the DMG file.
- Double click the dmg file and it gets mounted as a
virtual disk and reveal its contents. - Copy the .app file to the Applications folder in the
mac - Eject the DMG file by clicking on eject button.
- Open Terminal.
- Build the PKG file using the productbuild command
- Provide the device login password and wait a few seconds for the build to finish.
- The PKG file gets created at the desired location.
sudo productbuild --component /path_to_installedapp/macapp.app / path_to_savedpackage/packagename.pkg
The two arguments specify the location of the installed .app file (path_to_installedapp/macapp.app) and the location to create the PKG file (path_to_savedpackage/packagename.pkg), respectively.
To distribute the created PKG files, check out Distribute macOS Enterprise App using Hexnode.
That’s all! The process is quite easy for most applications. The only red flag here is that not all apps are created equal, so it may affect the time required for the PKG build.