【发布时间】:2015-12-29 23:48:34
【问题描述】:
我正在使用 installrails.com 在装有 OS X El Capitan 的新机器上安装 Rails。
通过命令行安装 rails 后,我现在遇到许多错误,因为系统会寻找过时的 gem 来下载。由于 gem 不可用,安装无法完成。
我应该如何进行?如果需要,我可以重新安装。
谢谢!
我收到的前几个错误 --
Could not find CFPropertyList-2.3.2 in any of the sources
Run `bundle install` to install missing gems.
运行捆绑安装后
Could not find fog-aliyun-0.0.10 in any of the sources
运行了fog-aliyun gem的包更新并得到了
Installing pg 0.18.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/supertext/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151228-30240-pkfnrw.rb 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
需要配置选项。
还有各种过时的宝石和权限问题。
注意:有人建议这是重复的。但是,我在几十个 gem 上遇到 gem 错误,而不仅仅是 pg / postgresql。因此,虽然在我确定上游问题后该注释很有帮助,但它并不是问题的唯一答案。
【问题讨论】:
-
以防万一,尝试更新XCode并通过打开>接受并关闭之后接受条款,这让我之前有些头疼。如果您使用自制软件,Brew Doctor 或许也可以提供帮助。
-
我现在已将问题范围缩小到以下问题 --> Rails 已安装并且在运行新应用程序时运行良好。当运行一个包含几个月代码和大量 gem 的应用程序时,我会遇到很多 gem 错误。所以看起来这实际上不是安装问题。
-
删除 gemfile.lock 并运行捆绑安装。现在我遇到了 Brad 提到的 pg gem 错误并正在解决它。
-
brew install postgresql