我正尝试在本地计算机上安装与Postgres.app一起使用的pg gem。我在经营小牛队。
Postgres.app已安装并运行正常,但我无法让gem正常工作。我做了以下工作:
苹果使用命令'env documentation
都没有成功。下面是我收到的具体错误消息:
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}/如果你能提供任何帮助,我将不胜感激。谢谢!
发布于 2013-11-27 04:06:17
你可能有一个错误的--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发布于 2014-07-23 04:41:59
在我的例子中(运行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 发布于 2014-03-03 03:06:46
在一台全新的mac上,我不得不这样做:
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 pghttps://stackoverflow.com/questions/20224483
复制相似问题