Category filter
How to convert DMG to PKG Mac App for distribution
DMG files or Disk Image files used to install software contain app files, installation files and other file types. They are usually used by macOS software installers downloaded from the internet.
PKG files are macOS installation packages containing installer scripts and compressed installation files 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. Hence, it is ideal to convert DMG files to PKG files to push them 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 they can then be distributed via Hexnode as enterprise apps.
PKG files can only be created from DMG files containing applications by using the Terminal.
Steps to convert macOS DMG files to PKG files.
- Go to the folder that contains the DMG file.
- Double click the DMG file. It gets mounted as a
virtual disk and reveals its contents. - Copy the .app file to the Applications folder in the
macOS device. - Eject the DMG file by clicking on the eject button.
- Open Terminal.
- Build the PKG file using the productbuild command
- Provide the device login password and wait for 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.
The only red flag here is that not all apps are created similarly, which may affect the time required for the PKG build.