关于安装cocoapods遇到的一些坑(ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2)

1.移除现有的Ruby

$gem sources --remove https://rubygems.org/

2.使用淘宝镜像

$gem sources -a https://ruby.taobao.org/

3.验证当前ruby版本

$gem sources -l

成功后提示:

*** CURRENT SOURCES ***


https://ruby.taobao.org/

4.开始安装cocoapods

$sudo gem install cocoapods

这时候提示:

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.

这个地方很坑,之前安装cocoapods一直是没有这个问题的,这里提示Ruby版本要大于或等于2.2.2

于是查看ruby版本

$ruby -v

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]


果然这里就要升级Ruby版本啦

查看目前的所有ruby版本:

$rvm list known

如果提示command not found 请先安装rvm

$curl -L get.rvm.io | bash -s stable  

如果已安装会列出所有的ruby版本:

# MRI Rubies

[ruby-]1.8.6[-p420]

[ruby-]1.8.7[-head] # security released on head

[ruby-]1.9.1[-p431]

[ruby-]1.9.2[-p330]

[ruby-]1.9.3[-p551]

[ruby-]2.0.0[-p648]

[ruby-]2.1[.8]

[ruby-]2.2[.4]

[ruby-]2.3[.0]

[ruby-]2.2-head

ruby-head


# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2


# JRuby

jruby-1.6[.8]

jruby-1.7[.23]

jruby[-9.0.5.0]

jruby-head


# Rubinius

rbx-1[.4.3]

rbx-2.3[.0]

rbx-2.4[.1]

rbx[-2.5.8]

rbx-head


# Opal

opal


# Minimalistic ruby implementation - ISO 30170:2012

mruby[-head]


# Ruby Enterprise Edition

ree-1.8.6

ree[-1.8.7][-2012.02]

  • 24
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值