Mac Operations

Rolling OS X packages with FPM and Homebrew

Two cool open-source package managers, FPM and Homebrew, recently got some new OS X Installer Package capabilities.

fpm -t osxpkg

Jordan Sissel’s FPM packaging tool was designed for systems administrators to very easily roll packages for RedHat, Debian and other platforms and abstract away the obscure details of the package formats themselves.

FPM is written in Ruby, and I decided (somehow) it could be a fun learning exercise to look at implementing support in it for building OS X packages. FPM version 0.4.27 was released a few days ago, available as a gem install, and now supports OS X package input and output, at least on OS X platforms with pkgbuild installed (built-in on OS X 10.8 and 10.7, for 10.6 requires an installation of Xcode 3.2.6 or later).

OS X packages are almost always used in a very different context than rpms and debs (and you are hopefully never going to need to convert an rpm to an OS X package), but building them with FPM still allows one to benefit from some cool features FPM provides all with a single command invocation:

In addition to what we get with FPM for free, the osxpkg package type in FPM also supports a few extras, the more noteworthy ones being: custom restart-action and dont-obsolete values as simple command options rather than requiring manual PackageInfo templates. More options could easily be added as FPM already has built-in methods for templating package metadata files.

brew pkg

I was recently learning how to update a Homebrew package (ie. ‘formula’) so that I could compile an up-to-date version of dfu-programmer on my Mac. I was reminded of several times at work when recent versions of packages I wanted to install were available in Homebrew, but didn’t want to just install Homebrew on a server, as it is targeted more towards developer systems and assumes ownership of /usr/local. I did like the idea that specific ‘formulae’ are maintained voluntarily by people who probably know more than I about configuring/running a particular software on OS X, and that these are shareable and forkable if I wanted to improve one myself.

Homebrew provides a nice way to provide added functionality via custom scripts, and so was born brew-pkg, a command to build an OS X installer package from an installed formula, with a couple bonuses:



comments powered by Disqus