I have done "brew install postgresql" got 9.0.2 but running "gem install pg" I get missing library
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 *
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
"env ARCHFLAGS="-arch x86_64" gem install pg" worked for me when using Snow Leopard.
精彩评论