在OSX 10.9上安装pg gem失败

7
当运行bundle install(或gem install pg)时,我遇到了以下错误。我已经尝试修复Xcode命令行工具。
/Users/josh/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
  • Ruby 2.0.0
  • Rails 4.0.2
  • OSX 10.9.1

在 https://dev59.com/BGIk5IYBdhLWcg3wdd4l#60039365 上提供了一份全面的答案。 - Esmaeil MIRZAEE
3个回答

12

非常感谢,伙计。运行得很好 :) - user2693845

5

供参考,@marcamillion链接的代码如下:

brew update
brew install postgresql

bundle install

太棒了!这对我在全新安装的OS X 10.10.5上解决了问题。 - Muhammad Abdul-Rahim

3

我遇到了同样的问题.. 我修改了Gemfile.lock,只把pg(0.17.1)替换为pg(0.18.1)。

下载并安装PostgreSQL 9.4

现在使用以下命令安装pg

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接