【问题标题】:Unable to install gem pg for ruby on rails [duplicate]无法在 Rails 上安装 gem pg for ruby​​ [重复]
【发布时间】:2017-03-19 12:25:04
【问题描述】:

尝试了几种使用 HomeBrew 和 RVM 安装的方法后,我仍然无法安装 gem pg

我使用了所有 Stackoverflow 回答的问题,但它们根本没有帮助我。

我正在使用 Postgresql 应用程序

我的问题是我做错了什么? 我没有为 PG 创建用户,因为主要问题是我无法在我的 Mac 上安装 PG

$ sudo gem install pg -v '0.19.0'
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 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


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.19.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.19.0/ext/gem_make.out

【问题讨论】:

  • 您尝试过哪些解决方案?了解什么不起作用以及这些尝试的结果可能会有所帮助...我在pg 上遇到过类似的问题,其中一个错误几乎完全一样。
  • @Antonio 我也试过这个和 rvm 命令 brew uninstall postgresql brew install postgresql gem install pg
  • 您是否尝试过从头开始重新安装 XCode?我相信,当我不久前升级到 El Capitan 时,这就是让我摆脱困境的原因。 stackoverflow.com/questions/19262312/…
  • @Antonio 我的 mac 新鲜。从今天早上开始重新安装

标签: ruby-on-rails postgresql


【解决方案1】:

它说找不到 postgreSQL 客户端库。

看看这个答案。据我所见,这个问题的输出与您所拥有的相同。

Can't find the PostgreSQL client library (libpq)

【讨论】:

  • @GYTO,你能把它标记为正确答案吗?所以,如果其他人有类似的问题并遇到这个问题,他们就会知道什么是有效的。
  • @Antonia 抱歉我很忙,现在解决了,再次感谢
猜你喜欢
  • 2016-03-27
  • 2012-03-28
  • 2017-01-31
  • 2015-04-06
  • 1970-01-01
  • 1970-01-01
  • 2012-07-11
  • 2020-02-28
相关资源
最近更新 更多