April 6, 2005

PostgreSQL | Building PostgreSQL on OS X

So, this rather small Mac ends up on my desk. Ostensibly it's there for creative, multimedia purposes, but hey, underneath all the eye candy there's a decent operating system ripe for a bit of source compilation.

The first hurdle is getting a decent build environment. Basically this involves inserting the operating system DVD and installing the XcodeTools. The whole caboodle takes up about a GB of space, which is way too much; on the first attempt I tried to select what seemed to be a reasonable selection, but it turned out this didn't install much in the way of headers. Installing the whole lot solved that problem; most of the space is taken up by Apple Developer documentation files, which I presume can be removed somehow.

Then it's just a case of ./configure --prefix=/path/to/wherever --without-readline, make and make install.

Unfortunately, as you can tell from the ./configure, the readline doesn't seem to be available on the native system, which is a pity because it's what helps make psql so much nicer than say Oracle's SQL*Plus. This is where Fink comes in handy: Debian-style package management for OS X; this provides the necessary readline packages, whose locations do however need to be explicitly provided: ./configure --prefix=/path/to/wherever --with-includes=/sw/include/ --with-libraries=/sw/lib/.

Apple's Developer Connection has a comprehensive write-up on PostgreSQL source installation at: http://developer.apple.com/internet/opensource/postgres.html.

Binary packages are also available from: http://www.entropy.ch/software/macosx/postgresql/.

Posted at 8:10 PM