安装 cocoapods 时出错

Error during install cocoapods

我正在尝试安装最新的 CocoaPods(当前为 1.0.1),但它显示以下错误。

$ sudo gem install cocoapods
Password:
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.9.0.gem (100%)
Successfully installed minitest-5.9.0
Fetching: concurrent-ruby-1.0.2.gem (100%)
Successfully installed concurrent-ruby-1.0.2
Fetching: activesupport-5.0.0.gem (100%)
ERROR:  Error installing cocoapods:
activesupport requires Ruby version >= 2.2.2.

安装指南说

[...] it will be installable with the default Ruby available on macOS. You can use a Ruby Version manager, however we recommend that you use the standard Ruby available on macOS unless you know what you're doing.

ruby 不是我的首选语言,所以任何人都可以帮助我,我如何安装 cocoapods gem?

OSX 版本:OS X El Capitan 10.11.5

首先安装旧版本的'activesupport'(与ruby 2.0 和cocoapods 兼容),然后安装cocoapods。 sudo gem install activesupport -v 4.2.6

请从下面安装最新版本的 Ruby 和 RVM(Ruby 版本管理器)link:(步骤在 this link 中提供)

然后在终端中 运行 "sudo gem install cocoapods"。