【问题标题】:gem install pg fails on OSX 10.9 [duplicate]gem install pg 在 OSX 10.9 上失败 [重复]
【发布时间】:2014-01-09 00:29:04
【问题描述】:

运行 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

【问题讨论】:

标签: ruby-on-rails ruby macos osx-mavericks


【解决方案1】:

我今天也遇到了同样的问题,这个答案为我解决了。

https://stackoverflow.com/a/19620569/91970

希望对您有所帮助。

总结

酿造更新

brew 安装 postgresql

捆绑安装

【讨论】:

  • 非常感谢朋友,辛苦了:)
【解决方案2】:

我也遇到了同样的问题。我修改了 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

【讨论】:

    【解决方案3】:

    作为参考,代码@marcamillion 链接到:

    brew update
    brew install postgresql
    
    bundle install
    

    【讨论】:

    • 太棒了!这对我来说是全新安装 OS X 10.10.5 的诀窍
    猜你喜欢
    • 2015-04-23
    • 1970-01-01
    • 2012-05-07
    • 2012-03-03
    • 1970-01-01
    • 2014-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多