MacOS – Repackaging .pkg files without installing/unpacking

installmacospkg

Recently I was tasked with finding out a way to prepare OS X applications for automatic distribution to multiple machines.

Most applications require some tampering with their preferences before deploying. I have done it for Windows machines before, and usually I could just replace the preference files/registry entries right inside the .msi installer, using tools like Orca, Wise Package Studio and so on.

I am new to macs, but when I try to look for something similar for OS X, all I find is software to make packages from scratch (PackageMaker, Iceberg, etc.), but nothing for editing already created .pkg files.

So here is the question: is there a way to easily edit the content of .pkg file (replace some files, add a script, etc.), without having to install/unpackage it and then package the configured stuff back?

Best Answer

You can use the Flat Package Editor from Apple.

  1. Go to Apple's Developer downloads site and download the Auxiliary Tools for Xcode - Late July 2012.
  2. Once downloaded, open the DMG.
  3. Find PackageMaker.app and open the package contents, then navigate to Contents/Resources.
  4. Copy Flat Package Editor.app to /Applications or elsewhere then open it.

From this app you can open a .pkg and edit the contents by dragging files out, editing them and dragging them back in, then saving the package.


Packages can be resigned using the button on the title bar: