seeing the contents of the new .pkg format for Mac OS X

The original .pkg format for Mac OS X installer packages followed the old pattern established in NeXTSTEP of a special folder format with an extension to label it a file type. Inside of the .pkg folder, you could find the Contents/Archive.bom file, .bom meaning “Bill Of Materials”, i.e. a listing of the files that the package would install. Using the handy lsbom, you can get all of the info in a nice, scriptable way. The downside to this folder format is that in order to post it for download or other similar situations, it had to be turned into a single file, like a .zip or .tar.gz.

So Mac OS X 10.5 introduced a new format where it was already bundled up into a file, so there is no Contents/Archive.bom to use with lsbom. But there is a way! The new format is still a folder, but with a different layout, and then made into a file using xar, which is something like tar and it comes with Mac OS X. So we have to treat the new format .pkg like a tarball or zip:

tmp $ mkdir dnscrypt
tmp $ cd dnscrypt
dnscrypt $ xar -xzf ~/Downloads/dnscrypt-osx-client.pkg
dnscrypt $ ls
Distribution                            dnscrypt.pkg                  dnscryptproxy-1.pkg
Resources                               dnscryptClientPostflight.pkg  dnscryptproxy.pkg
comopendnsosxdnscryptconfigupdater.pkg  dnscryptClientPreflight.pkg   dnsupdater.pkg
comopendnsosxdnscryptmenubar.pkg        dnscryptmenubar.pkg

This package actually has multiple sub-packages, but they are all bundled together, so the one xar operation has expanded them all into folders again. There is no longer the extra Contents/ folder level, the files are just directly in the .pkg folder. And the Archive.bom file has been renamed to just Bom. And with a little bash script, we can see the whole contents:

for bom in */Bom; do echo --------------------; echo $bom; lsbom $bom; done

Advertisement

You must be logged in to post a comment.

Follow

Get every new post delivered to your Inbox.