难以使用Mac Postgres App捆绑pg

not*_*rab 3 postgresql macos gem bundle pg

我尝试在我的Mac上捆绑我的Rails应用程序.在家里它工作正常,我已经设法解决它自己以前,但这次无论我尝试什么,似乎没有什么似乎正在努力解决它.

运行bundle/bundle install时收到的错误如下:

安装pg(0.17.0)Gem :: Installer :: ExtensionBuildError:错误:无法构建gem原生扩展.

/Users/notrab/.rbenv/versions/2.0.0-p0/bin/ruby extconf.rb
Run Code Online (Sandbox Code Playgroud)

检查pg_config ...否否pg_config ...尝试无论如何.如果构建失败,请再次尝试使用--with -pg-config =/path/to/pg_config检查libpq-fe.h ...否找不到'libpq-fe.h header *extconf.rb失败* 由于某些原因无法创建Makefile,可能缺少必要的库和/或标头.检查mkmf.log文件以获取更多详细信息.您可能需要配置选项.

提供的配置选项: - with-opt-dir --without-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/notrab/.rbenv/versions/2.0.0-p0/bin/ruby​​ --with-pg --without-pg --with-pg-config --without-pg-config --with-pg_config --without-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} /

Gem文件将保留在/Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0中进行检查.

结果记录到/Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0/ext/gem_make.out

安装pg(0.17.0)时发生错误,Bundler无法继续.gem install pg -v '0.17.0'在捆绑之前确保成功.

我显然试过跑步

gem install pg -v'0.17.0'并且它说它成功但是再次捆绑显示同样的错误.

我也试过跑步

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

文档http://postgresapp.com/documentation中概述了这一点,但是当我尝试捆绑时出现相同的错误.

我绕圈而且不知道如何解决它.

我的Gemfile看起来像:

group :development, :test do
    gem "better_errors"
    gem 'meta_request'
    gem 'binding_of_caller'
    gem 'sqlite3'
end

group :production do
    gem 'pg'
end
Run Code Online (Sandbox Code Playgroud)

非常感谢,

杰米

Zam*_*ith 11

你有没有试过加入export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"你的.bash_profile

  • 对于较新版本的Postgres.app,您可能需要`export PATH =/Applications/Postgres.app/Contents/Versions/9.3/bin:$ PATH` (6认同)
  • 对于任何版本的 Postgres.app,此路径都更好,因为它是面向未来的:`/Applications/Postgres.app/Contents/Versions/latest/bin` (3认同)