Postgres.app으로 Mavericks에 pg gem을 설치할 수 없습니다.
내 로컬 컴퓨터에 Postgres.app과 함께 사용할 pg gem을 설치하려고합니다. 저는 매버릭스를 운영하고 있습니다.
Postgres.app이 설치되어 잘 실행되고 있지만 gem을 작동시킬 수 없습니다. 다음을 수행했습니다.
- Postgres.app 문서에서 'env ARCHFLAGS = "-arch x86_64"gem install pg---with-pg-config = / Applications / Postgres.app / Contents / MacOS / bin / pg_config'명령을 사용했습니다.
- Homebrew를 업데이트하고 Apple GCC 4.2를 설치했습니다.
- Xcode 개발자 도구를 설치했습니다.
- Postgres.app bin 및 lib 디렉토리를 모두 참조하도록 $ PATH를 업데이트했습니다.
모두 성공하지 못했습니다. 수신 된 특정 오류 메시지는 다음과 같습니다.
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}/
도움을 주시면 감사하겠습니다. 감사!
에 대한 경로가 잘못되었을 수 --with-pg-config
있습니다. 실제로 있는지 확인하십시오.
다음을 사용하여 올바른 경로를 찾을 수 있습니다 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
필자의 경우 (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
새로운 Mac을 사용하기 위해해야 할 일은 다음과 같습니다.
- 앱 스토어에서 Xcode 도구 설치
- Xcode 도구를 열고 라이센스에 동의하십시오.
이제 실행하십시오 (미래 보장 명령).
version=$(ls /Applications/Postgres.app/Contents/Versions/ | tail -1) gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/$version/bin/pg_config .
문제가있는 경우 mkmf.log에서 실제 오류를 확인하여 약간의 문제를 해결할 수 있습니다 (rvm을 사용하는 경우).
cd ~/.rvm ; find . -name mkmf.log | grep pg
이 명령으로 pg를 설치할 수있었습니다.
gem install pg -- --with-pg-config=/Library/PostgreSQL/9.3/bin/pg_config
나는 달리면서 내 길을 찾았다.
sudo find / -name "pg_config"
그리고 pg-0.17.1을 성공적으로 설치했습니다.
이 문제를 해결하기 위해 터미널 창에서 다음을 사용하여 homebrew를 사용하여 postgres를 설치했습니다.
brew install postgres
Homebrew는 여기에서 찾을 수 있습니다.
adding the postgress bin dir to the path also does the trick. just add the bin to the pat like this. with recent installs the latest symbolic link makes sure that this path should be 'stable' for future version upgrades.
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
This worked for me:
gem install pg -- --with-pg-config=`which pg_config`
For future reference, since a lot of us are posting new paths for the new version numbers:
Currently I'm seeing a symlink called latest
in /Applications/Postgres.app/Contents/Versions/
.
You should be able to just do:
$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
And forget about the version number. This might not apply to every (older) version, but I myself was looking for a snippet I could save and reuse.
참고URL : https://stackoverflow.com/questions/20224483/cannot-install-pg-gem-in-mavericks-with-postgres-app
'Development Tip' 카테고리의 다른 글
Sort 및 Pageable 모두에서 Spring 데이터 JPA를 사용하여 데이터를 즉시 쿼리하는 방법은 무엇입니까? (0) | 2020.10.31 |
---|---|
AngularJS-컨트롤러에서 모듈 상수 가져 오기 (0) | 2020.10.31 |
google-places-api를 사용하는 간단한 HTML 페이지에 대한 ApiNotActivatedMapError (0) | 2020.10.30 |
UIView의 위치를 변경하는 간단한 방법? (0) | 2020.10.30 |
Ruby로 캐리지 리턴을 제거하려면 어떻게해야합니까? (0) | 2020.10.30 |