2014-09-30 115 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 

您可能必須改變路徑有點指向正確的地方。