2014-10-09 2 views
0

동안 내가 처음으로 RoR에 튜토리얼의 마지막 단원에서 그리고 난 터미널 입력 install bundle오류를 모두 PG의 설치 및 번들

그 결과 개방하도록 지시하고 있어요 :

tonys-mbp:crumblr Tony-MBP$ bundle install 
Fetching gem metadata from https://rubygems.org/.......... 
Resolving dependencies... 
Using rake 10.3.2 
Using i18n 0.6.11 
Using json 1.8.1 
Using minitest 5.4.2 
Using thread_safe 0.3.4 
Using tzinfo 1.2.2 
Using activesupport 4.1.6 
Using builder 3.2.2 
Using erubis 2.7.0 
Using actionview 4.1.6 
Using rack 1.5.2 
Using rack-test 0.6.2 
Using actionpack 4.1.6 
Using mime-types 2.4.1 
Using mail 2.6.1 
Using actionmailer 4.1.6 
Using activemodel 4.1.6 
Using arel 5.0.1.20140414130214 
Using activerecord 4.1.6 
Using bundler 1.7.3 
Using coffee-script-source 1.8.0 
Using execjs 2.2.1 
Using coffee-script 2.3.0 
Using thor 0.19.1 
Using railties 4.1.6 
Using coffee-rails 4.0.1 
Using hike 1.2.3 
Using multi_json 1.10.1 
Using jbuilder 2.2.2 
Using jquery-rails 3.1.2 
/Users/Tony-MBP/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.3/lib/bundler.rb:302: warning: Insecure world writable dir /usr/local in PATH, mode 040777 

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

    /Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/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. 

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/Tony-MBP/.rvm/rubies/ruby-2.1.3/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}/lib 

extconf failed, exit code 1 

Gem files will remain installed in /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/gems/pg-0.17.1 for inspection. 
Results logged to /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/extensions/x86_64-darwin-13/2.1.0/pg-0.17.1/gem_make.out 
An error occurred while installing pg (0.17.1), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling. 

을 그래서 Bundler를 계속 사용할 수 있도록 pg를 설치하려고했습니다. 그러나, 나는이 오류가 발생했을 때 입력 : gem install pg -v '0.17.1' :

결과 :이 모두 실패하는 이유

tonys-mbp:crumblr Tony-MBP$ gem install pg 
Building native extensions. This could take a while... 
/Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local in PATH, mode 040777 
ERROR: Error installing pg: 
    ERROR: Failed to build gem native extension. 

    /Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/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. 

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/Tony-MBP/.rvm/rubies/ruby-2.1.3/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}/lib 

extconf failed, exit code 1 

Gem files will remain installed in /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/gems/pg-0.17.1 for inspection. 
Results logged to /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/extensions/x86_64-darwin-13/2.1.0/pg-0.17.1/gem_make.out 

하는 사람이 식별하는 데 도움 주실 래요? 개발자 초기 단계에서 완전한 newb를 도와 주셔서 감사합니다.

편집 :

Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config' 
    This could take a while... 
    /Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local in PATH, mode 040777 
    ERROR: Error installing pg: 
     ERROR: Failed to build gem native extension. 

답변

0

추가 조사가 끝나자 OS X Mavericks는 pg 또는 번들 보석으로 잘 작동하지 않았습니다.

나를 위해 일한 4 단계 수정 :

brew update 
brew install postgresql 
gem install pg 
bundle install 
1

이 오류 메시지가 pg_config가 누락하고 경로 pg_config 파일에 전달해야한다고 :

@Lidan에서 제안 된 코드를 시도 후이 내가 무엇을 얻을 , 대부분이 파일은 PostgreSQL 설치 디렉토리에 있습니다.

그러나 개발 작업을 수행하는 동안 로컬 포스트그레스 서버를 실행하는 데 Postgres.app을 사용하는 경우 postgres.app는 자체 포함 된 응용 프로그램이기 때문에이 파일이 누락됩니다. 사용하여 보석을 다시 설치하십시오 : 당신이 brew install postgresql를 통해 포스트 그레스를 설치할 때 포스트 그레스 서비스가 백그라운드에서 실행하고 메모리를 사용하기 때문에 내가 Postgres.app를 사용하는 것이 좋습니다

$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config 

Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config' 
This could take a while... 
Successfully installed pg-0.17.1 
1 gem installed 

, 당신은 개발하거나 데이터베이스를 사용하지 않을 경우에도. Postgres.app는 내 경험에 비추어 OSX에서 개발 환경에 더 효율적입니다.