Installing new Ruby postgresql adapter on Leopard

I need to fix a project which uses PostgreSQL. On a fresh Leopard install with postgresql 8.3 installed from ports I ran into this problem:

$ sudo gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-pg:
ERROR: Failed to build gem native extension.

The solution is quite simply. Just make sure pg_config can be found by the gem installer.

$ mdfind pg_config|grep bin|uniq
/opt/local/lib/postgresql83/bin/pg_config

In this case make sure /opt/local/lib/postgresql/bin is available in the path when executing the gem command

$ PATH=/opt/local/lib/postgresql83/bin:$PATH sudo gem install pg
This entry was posted in rails, ruby and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>