Jeff McCune home
Package MakerYou may have been given a package provided by some vendor, and they didn't package things quite to your standards. Perhaps they're installing setuid root executable programs with world-writable permissions all over your system, or they have problematic post flight scripts which try to modify the dock or open up a web page. Having an Apple package is nice, but it's not much good if you can't easily deploy it to a large number of hosts. I generally go about fixing poor quality packages using the following methods. To fix misbehaving scripts, I generally just dive right in and hack the script itself. If you right click on the package and "Show Package Contents" you can dive into the Resources folder and directly modify the preflight, post-flight, pre-upgrade, and post-upgrade scripts as you see fit. Apple has a Knowledge Base article on the subject: Software Delivery Guide. To fix file permissions, I manually unpack the package archive, change any permissions that are wrong, and then re-package everything.
  1. Unpack the archive
    1. mkdir /tmp/RootFileSystem/
    2. cd /tmp/RootFileSystem/
    3. sudo pax -z -pe -r -f /Volumes/foobar/Foobar-1.2.3-4.pkg/Contents/Archive.pax.gz
  2. Open (Distributed with Xcode Tools.)
    1. Re-use the bundle identifier and version from the source package:
    2. You can optionally overwrite permissions when installing the package
    3. Ensure your permissions match the system default permissions on folders like /, /Library, /Applications, etc...
    4. To check what the system default permissions shoudl be, look at the owner, group, and file mode in the bill of materials file from the BaseSystem package:
      lsbom /Library/Receipts/BaseSystem.pkg/Contents/ | less
    5. Finally, repackage your cleaned up RootFilesystem by building your Package Maker project.
  3. Bundle the resulting package into a DMG (Optional):
    1. hdiutil create -srcFolder /tmp/Foobar.pkg /home/archive/osx/pkgs/apps/Foobar-1.0.0-1.dmg
This procedure allows you to verify (lsbom) and manually modify (pax + Package Maker) packages that don't meet your requirements.
Fork me on GitHub