UGH ......我在OS X Yosemite下破坏了我(以前运行的)Rails设置。我使用Homebrew更新了我的Git版本。在将Git放到我想要的位置之后,运行'rails c'会出现以下错误:
/Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg.rb:4:in `require': dlopen(/Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/lib/libpq.5.6.dylib (LoadError)
Referenced from: /Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle
Reason: image not found - /Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle
看到对pg_ext的引用,我试图验证我的postgresql安装的部分。如果我尝试'gem install pg'或尝试使用bundler更新gem,我会得到这个:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/grogers/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
*** 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.
我可能会让我的问题变得更糟,但我回过头来重新制作'brew install postgres',但仍然会遇到同样的错误。
任何帮助表示赞赏。谢谢!
答案 0 :(得分:2)
您是否也通过Homebrew升级Postgresql?如果没有,你运行的是什么版本的Postgres,以及如何安装它?
如果您升级了Postgres,则需要重建pg
gem的原生绑定:gem uninstall pg && gem install pg
。