*24 Jan 2015*
<div class="posthaven-post-body">
If you get this error (or similar) while trying to run \*\*bundle install\*\* on one of your Ruby projects or trying to install the \*\*pg\*\* gem:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/void/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb --with-iconv-include=/usr/local/opt/libiconv/include --with-iconv-lib=/usr/local/opt/libiconv/lib checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header \*\*\* extconf.rb failed \*\*\* Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
The solution is to install the gem like this:
sudo env ARCHFLAGS="-arch i386" gem install pg -- --with-pg-include=/Library/PostgreSQL/8.4/include/ --with-pg-lib=/Library/PostgreSQL/8.4/lib/
\*\*Note:\*\* Replace 8.4 with your installed PostgreSQL version in the above command.
</div>
[[tags/error|error]] [[tags/extension|extension]] [[tags/gem|gem]] [[tags/libpq-fe|libpq-fe]] [[tags/native|native]] [[tags/osx|osx]] [[tags/pg|pg]] [[tags/ruby|ruby]]