README.OS_X

Path: README.OS_X
Last Update: Thu Feb 10 19:23:38 +0000 2011

Compiling on MacOS X

If you are building/installing ruby-pg on MacOS X, and the installation doesn‘t work at first, here are a few things you can try.

Compiling With the Correct Architecture

OS X supports both architecture-specific binaries (e.g. i386), as well as universal binaries (i.e. i386 & ppc). If ruby is built as a universal binary and postgresql is not, you need to specify the path to the appropriate pg_config binary or set the environment variable ARCHFLAGS appropriately.

For example, if you‘re using the stock Ruby binary, and PostgreSQL 8.4.x installed from MacPorts (without specifying the {{{+universal}}} variant), do:

  gem install -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config

Alternatively, if the build system can‘t figure out which architectures it should include, you may need to set the ‘ARCHFLAGS’ environment variable explicitly:

  sudo env ARCHFLAGS='-arch i386' gem install pg

or, if you‘re building from source:

  rake compile ARCHFLAGS="-arch i386"

[Validate]