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.

Note:

For using downloaded DMG files:
Enable the “App Store and identified developers” option under Mac system preferences > Security and Privacy> Allow apps downloaded from.

PKG files can only be created from DMG files containing applications by using the Terminal.

Steps to convert macOS DMG files to PKG files.

  1. Go to the folder that contains the DMG file.
  2. Double click the DMG file. It gets mounted as a
    virtual disk and reveals its contents.
  3. Copy the .app file to the Applications folder in the
    macOS device.
  4. dmg file opens to show content.

  5. Eject the DMG file by clicking on the eject button.
  6. Open Terminal.
  7. Build the PKG file using the productbuild command
  8. 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.

  9. Provide the device login password and wait for a few seconds for the build to finish.
  10. The PKG file gets created at the desired location.
  11. pkg file from dmg file gets created at the desired location.

To distribute the created PKG files, check out Distribute macOS Enterprise App using Hexnode.

Note

Signing a PKG file is recommended to enforce corporate data security and ensure that the app in use is trustable, safe and malware-free. Check out How to sign pkg files for deployment.

The only red flag here is that not all apps are created similarly, which may affect the time required for the PKG build.

  • Deploying and Managing Apps