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.

4

3 回答 3

3

所以我从以下位置安装了 postgresSQL 安装程序:

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

然后我做了:

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

然后它起作用了:)

于 2013-06-01T00:22:31.113 回答
0

命令“bundle install --without production”对我有用。

于 2015-01-08T04:27:12.793 回答
0

使用这个命令“bundle install --without production”。

它对我有用。就我而言,我克隆了 rails app 的 git 存储库,并尝试了 bundle update,但失败并得到了相同的消息。

该命令会阻止本地安装生产 gem,例如 pg 和 rails_12factor gem。

于 2014-06-17T17:56:34.710 回答