Quick pkgbuild tutorial for building Installer Packages on OS X Mountain Lion

If you've not used pkgbuild before, it can be a bit daunting to go from the (admittedly rather confusing) GUI-based Package Maker to the command-line tool pk...

If you’ve not used pkgbuild before, it can be a bit daunting to go from the (admittedly rather confusing) GUI-based Package Maker to the command-line tool pkgbuild, but never fear, for making simple packages, it’s actually a lot easier. To illustrate common usage cases, here is an example of a package I had to build today to use with DeployStudio and Munki.

pkgbuild —identifier au.com.automatica.usertemplate.pkg —version 1.0 —root English.lproj —install-location /System/Library/User Template/English.lproj ~/Desktop/UserTemplate.pkg

What this does is builds an installer package, and puts it on my desktop (the last line of the command). The package identifier is au.com.automatica.usertemplate.pkg which needs to be a unique string for your package and consistent between different versions of the package so OS X knows it’s an upgrade install. The version was specified as 1.0 so if I add to this and bump the version, OS X knows to upgrade an existing installation. The root is the folder that gets added to the package, or the app and the install location is where the contents of the root get dumped.

Keep This Useful

Spotted something outdated or unclear?

If a step has changed, a screenshot no longer matches, or something here just does not work the way it should, get in touch and we will take a look.