Tuesday, August 16, 2011

Making Mac Installers

Apple's PackageMaker is buggy, buggy, buggy. Also poorly documented. And buggy.

PackageMaker is Cupertino's preferred tool for making installers for Mac software, and comes in two flavors: the PackageMaker GUI tool, and the packagemaker command-line tool.

Having used many awkward installer tools on Mac and Windows, I wasn't expecting a bed of roses. But what I got, others have already described eloquently here, and here, or here, and many other places on StackOverflow and Apple's installer-dev list.

In short, the PackageMaker GUI is the worst software I've seen come out of Apple since I began programming for the Mac in 1984. It crashes, it creates installers that crash, and it may take values you set and silently reset them to their defaults.

The command-line tool is much better, and I even used it for a while, but if you need more than a simple one-item install, it has scant documentation, and a steep learning curve requiring time-consuming experimentation.

What To Do?

Here's what I'm currently using as effective ways to make Mac installers:
  • One-off installers. These are installers which you will build once and never have to build again. In this case, the PackageMaker GUI will probably be fine if you're willing to tolerate the occasional crash. However, if you move your PackageMaker project to a different directory or a different Mac, it will silently reset options in the project and you'll get all kinds of unpleasant surprises come time to run installers you build from that project.
  • Installing one executable, and building the installer from the command line. This also includes building the installer as a shell command inside Xcode. I've done this, and the packagemaker command-line tool works fine. I pretty much just got all the info from Christopher Sexton's Codeography post, particularly the command at the end preceded by "Run the package maker build on the command line".
  • Everything else. Use one of the two excellent tools Stéphane Sudre has written. Iceberg is aimed at old-style "bundle" installers, and is what I'm currently using. Packages is aimed at newer "flat" installers - I haven't tried it as of this writing, but I have high hopes for it.
I hope that by the time you read this, Apple will have turned PackageMaker into a well-documented, stable system. But if you have troubles with PackageMaker at all, you can save yourself a lot of stress by immediately looking into alternatives.