복붙노트

[RUBY-ON-RAILS] Postgres.app와 매버릭스에서 페이지 보석을 설치할 수 없습니다

RUBY-ON-RAILS

Postgres.app와 매버릭스에서 페이지 보석을 설치할 수 없습니다

나는 내 로컬 컴퓨터에 Postgres.app와 함께 사용하기위한 페이지의 보석을 설치하려합니다. 나는 매버릭스를 실행하고 있습니다.

Postgres.app 설치하고 벌금을 실행,하지만 난 일에 보석을 얻을 수있다. 나는 다음과 같은 일을했습니다 :

성공없이 모든. 여기에 내가받은 특정 오류 메시지는 다음과 같습니다

Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/Brian/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
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/Brian/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
    --with-pg
    --without-pg
    --with-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}/

나는 당신이 제공 할 수있는 모든 도움을 주셔서 감사합니다 것입니다. 감사!

해결법

  1. ==============================

    1.당신은 아마, --with-PG-설정에 대한 잘못된 경로가 실제로이 있는지 확인합니다.

    당신은 아마, --with-PG-설정에 대한 잘못된 경로가 실제로이 있는지 확인합니다.

    당신과 pg_config 올바른 경로를 찾을 수 있습니다 :

    find /Applications -name pg_config
    

    최신 Postgres.app 버전에서 경로는 다음과 같습니다

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

    2.환경 아키텍처 플래그를 붙이는 경우 제 경우 (Postgres.app의 v9.3.4.2을 실행)에서 만 일 듯 :

    환경 아키텍처 플래그를 붙이는 경우 제 경우 (Postgres.app의 v9.3.4.2을 실행)에서 만 일 듯 :

    env ARCHFLAGS="-arch x86_64" gem install pg -- \
    --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config 
    
  3. ==============================

    3.새로운 Mac에서이기 때문에, 여기에 내가해야 할 일을했을 것입니다 :

    새로운 Mac에서이기 때문에, 여기에 내가해야 할 일을했을 것입니다 :

    당신은 문제가 있다면, 당신은 (RVM을 사용하는 경우)를 실행하여 찾을 수 mkmf.log의 실제 오류를 확인하여 약간의 문제를 해결할 수 있습니다 :

    cd ~/.rvm ; find . -name mkmf.log | grep pg
    
  4. ==============================

    4.나는이 명령을 사용하여 페이지를 설치 할 수 있었다

    나는이 명령을 사용하여 페이지를 설치 할 수 있었다

        gem install pg -- --with-pg-config=/Library/PostgreSQL/9.3/bin/pg_config
    

    나는 실행하여 내 길을 발견

        sudo find / -name "pg_config"
    

    나는 성공적으로 설치 PG-0.17.1

  5. ==============================

    5.경로로 위해 Postgress 빈 디렉토리를 추가하면 트릭을 수행합니다. 다만이 같은 팻에 빈을 추가합니다. 최근 설치 수와 최신 심볼릭 링크는이 경로가 미래의 버전 업그레이드에 대한 '안정적'할 것을 확인합니다.

    경로로 위해 Postgress 빈 디렉토리를 추가하면 트릭을 수행합니다. 다만이 같은 팻에 빈을 추가합니다. 최근 설치 수와 최신 심볼릭 링크는이 경로가 미래의 버전 업그레이드에 대한 '안정적'할 것을 확인합니다.

    export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
    
  6. ==============================

    6.이 문제를 해결하려면 나는 터미널 창에서 다음을 사용하여 사제를 사용하여 포스트 그레스를 설치 :

    이 문제를 해결하려면 나는 터미널 창에서 다음을 사용하여 사제를 사용하여 포스트 그레스를 설치 :

    brew install postgres
    

    브루은 여기에서 찾을 수 있습니다

    http://brew.sh

  7. ==============================

    7.이것은 나를 위해 일한 :

    이것은 나를 위해 일한 :

    gem install pg -- --with-pg-config=`which pg_config`
    
  8. ==============================

    8.미래 참고로, 우리의 많은 새로운 버전 번호에 대한 새로운 경로를 게시되기 때문에 :

    미래 참고로, 우리의 많은 새로운 버전 번호에 대한 새로운 경로를 게시되기 때문에 :

    현재 내가 /Applications/Postgres.app/Contents/Versions/의 최신라는 심볼릭 링크를보고 있어요.

    당신은 할 수 있어야한다 :

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

    그리고 버전 번호 잊어. 이것은 모든 (이상) 버전에 적용, 그러나 나는 나 자신이 찾고 있던 내가 저장하고 재사용 할 수 니펫을하지 않을 수 있습니다.

  9. from https://stackoverflow.com/questions/20224483/cannot-install-pg-gem-in-mavericks-with-postgres-app by cc-by-sa and MIT license