2014-09-30 116 views
0

运行bundle install和rails s时出现的问题将无法正确加载......已经尝试了所有我可以在类似问题上的老式Stackoverflow帖子上找到的东西,但无济于事。下面的错误。使用Xcode 6.0.1在OSX 10.9.5上安装gem`pg时出错

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

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20140930-556-1w549j8.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. 

Provided configuration options: 
     --with-opt-dir 
     --without-opt-dir 
     --with-opt-include 
     --without-opt-include=${opt-dir}/include 
     --with-opt-lib 
     --without-opt-lib=${opt-dir}/lib 
     --with-make-prog 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 
     --with-pg 
     --without-pg 
     --with-pg-config 
     --without-pg-config 
     --with-pg_config 
     --without-pg_config 
     --with-pg-dir 
     --without-pg-dir 
     --with-pg-include 
     --without-pg-include=${pg-dir}/include 
     --with-pg-lib 
     --without-pg-lib=${pg-dir}/ 

extconf failed, exit code 1 

任何帮助将不胜感激!

+0

请将错误从粘贴框移动到您的问题中。 *当*链接打破你的问题将是没有用的将来的搜索者寻找你的问题的答案。另外,把它放在你的问题之外的某个地方,你会迫使任何人试图帮助你去追逐它,这不是一件好事,因为它会减少帮助。让人们很容易帮助你。 – 2014-09-30 21:48:53

+0

另外,你的问题不是真正与OSX相关的。您应该从使用其他开发环境的人可能甚至不认为看起来的主题中删除该内容。作为一个简单的问题,你是否单独运行gem install pg?然后尝试捆绑? – Art 2014-09-30 22:44:45

+1

[试图安装pg gem时找不到'libpq-fe.h头文件]的可能的重复(http://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header -when-trying-to-install-pg-gem) – Amadan 2014-10-01 04:28:55

回答

1

问题是,您没有安装pg。第一步是安装Postgres。

在这里这样做:http://postgresapp.com/

下一步是与所需的配置文件安装pg宝石。是这样的:

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

您可能必须改变路径有点指向正确的地方。