“bundle update”无法安装带有本机扩展的pg(0.14.1)

时间:2013-02-13 19:00:28

标签: ruby-on-rails ruby

我运行bundle update(这样我可以安装rails),但是出现了这个错误:

$ bundle update
..... < other stuff ....>
Installing pg (0.14.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/user/.rvm/rubies/ruby-1.9.3-p374/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的新手,所有这一切,有人能告诉我这里有什么问题吗? 这是在OSX上

1 个答案:

答案 0 :(得分:2)

确保先安装postgres。我建议您通过Mac包管理器homebrew进行此操作。

brew install postgresql
关于如何在Mac上安装postgres的许多教程中的

Here is one

修改

看起来宝石无法找到你的postgres配置,这里有一个与你的问题类似的答案:

https://stackoverflow.com/a/9669523/277370