Rails - 运行bundle install时出现问题 - 安装pg(0.17.0)

时间:2013-12-01 02:29:24

标签: ruby-on-rails ruby gem rails-postgresql pg

运行'捆绑安装'我收到以下错误消息。

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/name/.rvm/rubies/ruby-2.0.0-p247/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.

我已尝试安装http://postgresapp.com/

但我仍然遇到这个问题?有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您需要在命令行上传递几个选项。像这样
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
如果您将postgres安装到其他位置,则需要修复pg_config文件的路径。