2
votes
gem install pg

Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
* extconf.rb failed *

2
This worked! env ARCHFLAGS="-arch x86_64" gem install pgelkalto23

2 Answers

4
votes

It looks like you either need to specify your postgres lib directory:

gem install pg -- --with-pg-dir=/path/to/pg_dir

or perhaps a 32bit vs.64 bit compatibility problem

ARCHFLAGS='-arch x86_64' gem install pg
0
votes

"env ARCHFLAGS="-arch x86_64" gem install pg" worked for me when using Snow Leopard.