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.

Note:

For using downloaded DMG files:
Enable ”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 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 and it gets mounted as a
    virtual disk and reveal its contents.
  3. Copy the .app file to the Applications folder in the
    mac
  4. dmg file opens to show content.

  5. Eject the DMG file by clicking on 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 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

If the app is an enterprise app or not from an identified developer, to ensure that the app is safe and free from malware, signing a PKG file is necessary. Check out How to sign pkg files for deployment.

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.

  • Deploying and Managing Apps