2012-09-28 52 views
0

我已經在互聯網這個看着所有的解決方案,重新安裝的一切,仍然一無所獲......當我做寶石安裝PG我得到:PostgreSQL的PG寶石將不會在OS X上安裝

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

/Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-pgsql->lib=/usr/local/Cellar/postgresql/9.2.1/lib --with-pg->config=/usr/local/Cellar/postgresql/9.2.1/bin/pg_config 

Using config values from /usr/local/Cellar/postgresql/9.2.1/bin/pg_config checking for libpq-fe.h... * 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 --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=/Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in try_cpp' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in block in find_header' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in block in checking_for' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in open' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in open' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in checking_for' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:969:in find_header' from extconf.rb:41:in '

Gem files will remain installed in /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection. Results logged to /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out

我嘗試設置pg_config路徑,安裝了xcode,從xcode安裝了我的命令行工具,我的ruby版本是由RVM安裝的1.9.3。

我的Mac是OS X Mountain Lion

謝謝你們!

回答

1

您錯過了Postgres客戶端庫頭文件(libpq-fe.h)。在Debian中,該軟件包被稱爲libpq-dev。我根本不知道Mac打包,但是如果沒有Mac版本庫,那麼源代碼中的PG客戶端庫就可以工作。

-1

我會建議安裝rvm https://rvm.io/rvm/install 然後運行rvm要求。這將安裝所有必需的軟件包,在安裝rails之後你可能會錯過「gcc49」,並且很願意安裝postgres。我會建議postgresapp或postgresql。