运行bundle install(或gem install pg)时出现以下错误我已经尝试修复xcode命令行工具
/Users/josh/.rvm/rubies/ruby-2.0.0-p353/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.
答案 0 :(得分:10)
我今天遇到了同样的问题,这个答案为我解决了。
https://stackoverflow.com/a/19620569/91970
希望有所帮助。
brew更新
brew install postgresql
捆绑安装
答案 1 :(得分:5)
作为参考,代码@marcamillion链接到:
brew update
brew install postgresql
bundle install
答案 2 :(得分:3)
我遇到了同样的问题..我修改了Gemfile.lock并仅用pg(0.18.1)替换了pg(0.17.1)。
下载PostgreSQL 9.4并安装在系统
中使用以下命令立即安装pg
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config