Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
Do You have flat packages or bundles? –  Mateusz Szlosek Apr 7 at 14:40
    
@MateuszSzlosek, it is not specified, so I have to assume we can have both. –  Boris Apr 7 at 16:00

2 Answers 2

up vote 1 down vote accepted

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:

share|improve this answer
    
Thanks, this tool looks useful. Doesn't work with bundles, but I guess it's an outdated format and I probably won't have to deal with it too much. Some sources claim it is quite buggy, though. –  Boris Apr 8 at 10:23

I am not aware of any Apple recommended tools to edit existing package, pkg or mpkg, files. Most packages are signed and thus any changes will invalidate their signature; although resigning is simple enough using pkgbuild and an appropriate installer certificate.

Wrapping Up Existing Packages

Consider creating a wrapper multi-package that adjusts any required files after installation. With this approach you can bundle up existing packages and then run post-install/update scripts as required.

pkgbuild

There is little documentation about crafting packages as Apple traditionally relied on the graphical tool PackageMaker. Since Mac OS X 10.8, the PackageMaker tool has been replaced by the command line tools productbuild and pkgbuild.

The tool you will want to investigate is pkgbuild. This tool eases the creation of packages containing multiple packages and scripts. About Distribution Definition Files talks about the internal file format.

share|improve this answer
    
Thanks, I did consider wrapping packages instead of editing them, so I will look into it if Flat Package Editor won't be able to help me. –  Boris Apr 8 at 10:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.