无法使用Postgres.app在小牛中安装pg gem [英] Cannot install pg gem in Mavericks with Postgres.app

查看:78
本文介绍了无法使用Postgres.app在小牛中安装pg gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地计算机上安装pg gem与Postgres.app一起使用.我在跑小牛.

I am trying to install the pg gem for use with Postgres.app on my local machine. I am running Mavericks.

Postgres.app已安装并且运行良好,但是我无法运行gem.我已完成以下操作:

Postgres.app is installed and running fine, but I cannot get the gem to work. I've done the following:

  1. 使用Postgres.app文档中的命令'env ARCHFLAGS =-arch x86_64" gem install pg---with-pg-config =/Applications/Postgres.app/Contents/MacOS/bin/pg_config
  2. 更新了Homebrew并安装了Apple GCC 4.2
  3. 安装了Xcode开发人员工具
  4. 更新了我的$ PATH以同时引用Postgres.app bin目录和lib目录

所有操作均未成功.这是我收到的特定错误消息:

All with no success. Here is the specific error message I receive:

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}/

非常感谢您能提供的任何帮助.谢谢!

I'd appreciate any help you can offer. Thanks!

推荐答案

您可能使用了错误的--with-pg-config路径,请检查它是否确实存在.

You probably have the wrong path for --with-pg-config, check if it's actually there.

您可以使用以下方法找到指向pg_config的正确路径:

You can find the correct path to pg_config with:

find /Applications -name pg_config

在最新的Postgres.app版本中,路径为:

In the latest Postgres.app Version the path is:

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

这篇关于无法使用Postgres.app在小牛中安装pg gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆