Create a macOS package with Packages

In this guide we will go through two ways to use the application Packages to create a macOS packages from a pkg or dmg. Package can after its build be used to distribute with your favorite MDM.

The Packages application used to create the pkg can be downloaded here: Packages

First example on how to use Packages

So in this example we want to add a pkg within another pkg so we can include a configurations file. That configuration file can contain some settings needed for the installation or some company unique settings.


  • Packages installed on your Mac computer
  • pkg file (GoogleChrome.pkg is used here to demonstrate)
  • postinstall (see below how to create this file)
  • configuration file (default.conf)

1. Open packages and choose Distribution and click Next

2. Give you project a name and click Create

3. You should now see your newly created project. But from now on we will only look at the tabs we need to use for this project. Click on Packages/Google Chrome and here we will change “mygreatcompany” and version to something else.

Find Identifier and Version

We will look at the original pkg file for its Identifier. You can unpack the *.pkg file from the Terminal.

pkgutil --expand /Users/yourusername/Desktop/GoogleChrome.pkg //Users/yourusername/Desktop/tmp.

Pacifist is otherwise a good tool to look in *.pkg files. Check in info.plist for “CFBundleIdentifier” and “CFBundleShortVersionString”

I change TAG Identifier to and version 120.0.6099.216

4. Mark Applications and click Set

Create postinstall file

5. Open TextEdit and create a Plain Text file.

Paste the script below and save as postinstall and close TextEdit.

Scripted looks like this:


# Chrome Installer script

# define the log file
echo "Installing Rapid 7" | tee -a "$log_file"

# Determine working directory (dirname $0 = Script path, working directory)

install_dir=dirname $0
echo "working directory set to $install_dir" | tee -a "$log_file"

# Installer command ($3 = Target volume) (dumplog = /var/log/install.log)

/usr/sbin/installer -dumplog -verbose -pkg "$install_dir/GoogleChrome.pkg" -target "$3"
echo “ installation started of Google Chrome” | tee -a "$log_file"

6. Find your created postinstall file and remove the filetype txt from the file. Secondary click ang get info on the file.

7. Open Terminal and type

sudo chmod a+x /path/to/your/postinstall

The postinstall shall now have become an black icon with green text

Go back to Packages and add the files.

8. Add postinstall to Post-Installation and under Additional Resources click the plus sign and add GoogleChrome.pkg and default.conf

9. Now let’s build the package in Packages.

Done! Try to install it and see if it’s work!

Second example on how to use Packages

So in this example we have a DMG file and we want make an pkg package of instead. This why you do not have to be limited on how some MDMs handling DMG files. Also this is just a tip and will not be included in the guide but if the application have a license key file that could be included and copied using postinstall similar to explained above.


  • Packages installed on your Mac computer
  • DMG file (GoogleChrome.dmg is used here to demonstrate)

1. Open Packages and create a Distribution package, click Next

2. Give it a Project Name: Google Chrome and Click: Create

3. Just look through the Project tabs.

4. Click the Packages Google Chrome

5. Let’s change the TAG Identifier and Version to the Google Chrome that we have downloaded.

6. Open the Google Chrome DMG file and a Windows shall open looking like this.

7. Secondary click (Right click) and click on Show Package Contents

8. Navigate to info.plist and open it in a text editor

9. Search of find “CFBundleIdentifier” and “CFBundleShortVersionString” and copy the string value.

10. Add that as TAG Identifier and version

11. Goto Tab Payload

12. Click Applications folder and click on Set

13. Click the + sign

14, Click on the disk image for Google Chrome and choose the App file.

Now Google is added to the project (note, do not close the Disk Image before you done with creating the package. Because then Packages will not find the app file)

If you close the DMG image file it will look like this in red text.

15. Packages menu Build, choose Build

Haven’t you saved your project its a good time to do so now.
Packes will build and hopefully it is a Build Success

16. Try to install the pack and see if it’s working.

Note! If you wanna sign the pkg, there is a guide for that here


Leave a Reply

Your email address will not be published. Required fields are marked *