无法安装gem pg

时间:2015-01-18 23:35:10

标签: postgresql pg

我知道已经提出了类似的问题,但没有一个解决方案对我有用。我正在运行Mac OS 10.10.1。我正在使用RVM和Homebrew。当我运行'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/2.0/usr/bin/ruby -r ./siteconf20150118-2187-o8ph5p.rb 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 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)
*** 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.18.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/pg-0.18.1/gem_make.out

我看到它建议检查我的mkmf.log,但我似乎无法找到它! 我试过撕掉RVM并重新安装它,我尝试在Brew中卸载postgresql,卸载Postgres应用程序,我已经检查过我正在使用xcode 6.1.1等。 我已经尝试了这里建议的每个解决方案

unable to install pg gem

在这里 bundle failing - Can't find the PostgreSQL client library (libpq)

但没有运气!

我一直在思考Stack Exchange和其他地方好几个小时,但似乎每个人都有一个稍微不同的问题,没有其他人的解决方案适合我。还有其他想法吗?

1 个答案:

答案 0 :(得分:0)

解决。我忽略了安装pgadmin III,因此它链接的库是错误的。