我在OSX上使用Postgres.app(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>'

如何才能正确安装pggem?

最佳答案

这对我有效:

sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config

只需再次检查/applications/postgres93.app..路径对你来说是存在的。

08-27 22:29