gpt4 book ai didi

macos - 使用 Mac Postgres App 很难 bundle pg

转载 作者:行者123 更新时间:2023-11-29 11:38:10 27 4
gpt4 key购买 nike

我曾尝试在工作时将我的 Rails 应用程序 bundle 到我的 Mac 上。在家里它运行良好,我之前已经设法自己解决了它,但这次无论我尝试什么似乎都无法解决它。

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

Installing pg (0.17.0) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/notrab/.rbenv/versions/2.0.0-p0/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.

Provided configuration options: --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 files will remain installed in /Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0 for inspection.

Results logged to /Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0/ext/gem_make.out

An error occurred while installing pg (0.17.0), and Bundler cannot continue. Make sure that gem install pg -v '0.17.0' succeeds before bundling.

我显然试过运行

gem install pg -v '0.17.0' and it says it was successful but bundling again shows the same error.

我也试过运行

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

文档 http://postgresapp.com/documentation 中对此进行了概述但是当我尝试 bundle 时出现同样的错误。

我在兜圈子,不知道怎么解决。

我的 Gemfile 看起来像:

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

group :production do
gem 'pg'
end

非常感谢,

杰米

最佳答案

您是否尝试过将 export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH" 添加到您的 .bash_profile

关于macos - 使用 Mac Postgres App 很难 bundle pg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19813266/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com