1

I've got the pg gem installed:

$ gem install pg
Building native extensions.  This could take a while...
Successfully installed pg-0.15.1
1 gem installed

$ gem list | grep pg
pg (0.15.1, 0.14.1)

However whenever i try to run 'bundle install' on my rails app, it tries to install pg again, and fails:

Installing pg (0.15.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.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)
...

How can i get bundler to simply use my already-installed version of pg? My Gemfile.lock has:

pg (0.15.1)

Which matches the version i can see with gem list. I'm not sure what's wrong here.

Chris
  • 39,719
  • 45
  • 189
  • 235
  • 2
    Take a look at - http://stackoverflow.com/questions/12273815/cant-install-pg-gem-on-mountain-lion/12273968#12273968 hope it helps – Deej May 31 '13 at 12:52
  • Thanks @David, that helped, i also had to set my bundle config to use its pg_config instead of my other installed pg version. – Chris Jun 01 '13 at 00:23

3 Answers3

3

So i installed the postgresSQL installer from:

http://www.enterprisedb.com/products-services-training/pgdownload#osx

Then i did:

bundle config build.pg --with-pg-config=/Library/PostgreSQL/9.2/bin/pg_config

Then it worked :)

Chris
  • 39,719
  • 45
  • 189
  • 235
0

Use this command "bundle install --without production" .

It worked for me. In my case, I cloned the git repository of rails app, and tried bundle update, but failed and got the same message.

That command prevents the local installation of production gems such as pg and rails_12factor gems.

teamaster
  • 403
  • 2
  • 6
  • 16
0

The command "bundle install --without production" worked for me.

kennysong
  • 504
  • 2
  • 6
  • 23