Packaging Software for macOS

March 11, 2019 - 3 minute read -
mac jamf

You won’t always need to re-package software. But when you do, it doesn’t have to be a Herculean task. munkipkg is a powerful and easy to use packaging tool for the macOS platform. And since it’s command-line based, it’s even easier to script.

In this tutorial, we are going to create a simple package for the Firefox browser. Be sure to download and install munkipkg, then download and expand the project template, before proceeding.

Step 1: Prepare The Project

In an effort to keep things organized, I’ve adopted the following directory structure on my package repository. This allows me the flexibility to maintain multiple versions of the package without needing the rename the packages themselves.


Let’s rename the directory structure in munkipkg-template as displayed below.


Step 2: Download Firefox

Download and install Firefox onto your system. Since this will be the version contained in our package, it’s a good practice to move the original disk image to the template directory for safekeeping.

Step 3: Setup The build-info.plist

When it comes to the identifier, name and version of our package, I’ve found that it’s best to keep things simple. Especially since installer on macOS uses these values to determine how to proceed.

Let’s update build-info.plist with the values displayed below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Step 4: Setup The

The purpose of automation is to repeatedly complete a task in a controlled, predictable fashion. Therefore the purpose of this script is to do three things. Create the folders. Populate the payload. Build the package.

Let’s update with the commands displayed below.


buildFolderStructure() {
    mkdir payload/Applications

buildPayload() {
    cp -Rf /Applications/ payload/Applications/

buildPackage() {
    munkipkg ../Firefox/


Step 5: Setup The

While it may not be necessary in every environment, I like having the ability to clean up after myself by creating an un-install script that only removes the things that my package has left behind.

Rename, then update, with the commands displayed below.

# Created by Jayson Kish on 03/11/19.
# Copyright 2019 by ToplessBanana. All rights reserved.
# Version 65.0.2

rm -rf /Applications/
rm /private/var/db/receipts/org.mozilla.pkg.Firefox.plist
rm /private/var/db/receipts/

# /bin/rm $0

Step 6: Build The Package

Now that we’ve installed Firefox and prepared our project, we’re ready to build the package. First, launch Terminal and cd into the project directory.

cd Desktop/Mozilla/Firefox/65.0.2/Firefox/

Then, execute to build the package.

sudo sh

You should now find Firefox.pkg located in our projects build directory.


Now that our package is ready, it can be deployed to your clients in many different ways. Jamf Pro, Munki or Apple Remote Desktop are great alternatives to manually installing your package using a GUI.

Additionally, while not all projects will be as simple or straightforward as re-packaging Firefox, hopefully you’ve found this tutorial to be a useful starting point.