Jay Taylor's notes

back to listing index

How to Inspect an OS X Package File (PKG) Without Installing – The Mac Observer

[web search]
Original source (www.macobserver.com)
Tags: os-x installer macOS mac-pkg-payload-extraction www.macobserver.com
Clipped on: 2017-11-08

Image (Asset 1/11) alt= Right click for contextual menu.

Inspecting Installer Packages

One might think, at first, that the OS X command "Show Package Contents" will work on another package file, an installer that ends in .pkg or .mpkg. That may or may not work depending on how the package file is constructed.

Note that .mpkg files are meta-packages that may contain .pkg files inside them that may be amendable to Show Package Contents.

However, if Show Package Contents isn't provided as a contextual menu option for either type of installer, don't despair. A different kind of tool is needed to analyze it. In this case, one can use a nifty OS X command line tool called pkgutil. It extracts the contents of the package file into its component pieces and can write it all out to a folder for inspection.

The easiest way to get started is to do a simple expand option and write it out to a named folder. The "man" page, of course, shows all the options. In the simplest case, the terminal commands would be:

pkgutil --expand package-name.pkg destination-folder
pkgutil --expand package-name.mpkg destination-folder

In these examples, the destination folder will be in the same folder as the package file, but one could define a path to somewhere else.

Here's what a dump looks like for one of my .mpkg files.

Image (Asset 2/11) alt=