gpt4 book ai didi

ruby - 使用 postgres.app 在 rvm 下要求 pg 时出错

转载 作者:数据小太阳 更新时间:2023-10-29 07:12:52 26 4
gpt4 key购买 nike

我正在使用 Postgres.app在 OS X (10.8.3) 上。我已经修改了我的 PATH,以便应用程序的 bin 文件夹位于所有其他文件夹之前。

Rammy:~ phrogz$ which pg_config
/Applications/Postgres.app/Contents/MacOS/bin/pg_config

我已经安装了 rvm 并且可以毫无错误地安装 pg gem,但是当我需要它时我得到一个错误:

Rammy:~ phrogz$ gem -v
1.8.25

Rammy:~ phrogz$ gem install pg
Fetching: pg-0.15.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed pg-0.15.1
1 gem installed

Rammy:~ phrogz$ ruby -v -e "require 'pg'"
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]
/Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': dlopen(/Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: @executable_path/../lib/libssl.1.0.0.dylib (LoadError)
Referenced from: /Applications/Postgres.app/Contents/MacOS/lib/libpq.dylib
Reason: image not found - /Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/lib/pg_ext.bundle
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/lib/pg.rb:4:in `<top (required)>'
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/phrogz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from -e:1:in `<main>'

我需要做什么才能正确安装 pg gem?

最佳答案

编辑:尽管目前这个答案的票数比接受的答案多,但接受的答案要简单得多、清晰得多。


安装 pg gem 时从路径中删除 Postgres.app 二进制文件,而是使用 OS X 内置的 postgres 安装来配置 gem。 pg 库稍后仍会正确连接到 Postgres.app 服务器。

Rammy:~ phrogz$ gem uninstall pg
Successfully uninstalled pg-0.15.1

# Modify PATH to remove /Applications/Postgres.app/Contents/MacOS/bin

Rammy:~ phrogz$ gem install pg
Fetching: pg-0.15.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed pg-0.15.1
1 gem installed

Rammy:~ phrogz$ ruby -v -e "require 'pg'"
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]

关于ruby - 使用 postgres.app 在 rvm 下要求 pg 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16453476/

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