没有postgresql捆绑安装失败

时间:2016-06-01 15:00:21

标签: ruby-on-rails ruby postgresql

当我运行bundle install时,我收到此错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/pg-0.18.4/ext
/usr/local/opt/ruby/bin/ruby -r ./siteconf20160601-64492-1nt86nq.rb 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.

... [a long list of config options] ...

An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.

然后,当我尝试gem install pg -v '0.18.4'之类的建议时,我会得到相同的错误而没有建议运行我刚试过的命令。我没有运行postgres并且从未安装过它,所以我对为什么会这样做感到有些困惑。

这里有一个类似的问题,但同样,我没有postgresql。我需要它吗?问题:gem install pg -v 0.12.2 error on mac

感谢任何帮助。谢谢。

1 个答案:

答案 0 :(得分:0)

是的,为了安装pg gem,您必须安装postgresql。您可以在their website上找到下载和安装说明。

具体来说,它说你需要一个pg_config文件,我想这将在安装时创建。