gem install pg --with-pg-config works, bundle fails

Have you tried running this before running bundle install?

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

See http://bundler.io/v1.3/bundle_config.html


In case somebody used macports to install postgres and are having problems finding their pg_config, try this:

bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config

I hope this helps somebody save some time. Cheers!


Had the same problem, fixed by installing libpq-dev.

Ref: https://bitbucket.org/ged/ruby-pg/issue/83/help-gem-install-pg-failed-on-opensuse-103


If you are not sure where your pg_config is, and assuming you are on Linux or Mac, you can run the following command:

which pg_config

this will return ==> /usr/pgsql-9.1/bin/pg_config

now use this path as

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

Done now bundle install