1

我在 Mac OSX lion 上,并且是 Ruby on Rails 编程的新手,所以请耐心等待。

我正在尝试开发队友的 Ruby on Rails 应用程序,但它要求我安装了 PostgreSQL。我用 Postgres.app(版本 9.2.2)安装了它。但是,当我运行 rails server 时,出现以下错误。

/Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib (LoadError)
  Referenced from: /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle
  Reason: image not found - /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg.rb:4:in `<top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/kevin/Documents/photowhoa/config/application.rb:13:in `<top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:53:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我已经尝试卸载并重新安装 PG gem。如果有人可以帮助我,那将非常感激。

4

1 回答 1

1

同样的问题。Rake 找不到 Postgres 库。这解决了问题:

导出 DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.2/lib

调整 lib 的路径以匹配您的路径。

于 2013-07-31T16:11:44.957 回答