Problems installing the pg gem with rvm, postgres 9.0, ruby 1.9.2-p136 on 64 bit Snow Leopard Problems installing the pg gem with rvm, postgres 9.0, ruby 1.9.2-p136 on 64 bit Snow Leopard postgresql postgresql

Problems installing the pg gem with rvm, postgres 9.0, ruby 1.9.2-p136 on 64 bit Snow Leopard


I think your problem is right here:

--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/postgresql.conf

The --with-pg-config switch probably wants to know where the pg_config script is rather than were postgresql.conf is. You should have a pg_config script somewhere under /opt/local/bin (probably), it should produce a big pile of stuff like this:

BINDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/binDOCDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/share/docHTMLDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/share/docINCLUDEDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/includePKGINCLUDEDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/includeINCLUDEDIR-SERVER = /Users/mu/Developer/Cellar/postgresql/9.0.1/include/serverLIBDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/libPKGLIBDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/lib...

when you run it. The pg_config script tells you (or whoever is asking) where the various header files and libraries are and which compiler flags are needed.

The "Exec format error" error message is the give away. That sounds like you're trying to execute something that the OS doesn't know how to execute and I wouldn't expect OSX to know how to execute some arbitrary configuration file.


Simplest fix I use: add /opt/local/lib/postgresql90/bin/ to your $PATH.

Say you use bash shell, then in ~/.bashrc

PATH=/opt/local/lib/postgresql90/bin:$PATH

Now a simple line in Gemfile:

gem 'pg'

will just work.