ruby版本低造成Cocoapods出错

之前正常使用的Cocoapods,pod update的时候突然报错了:

/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'cocoapods' (>= 0) among 33 total gem(s) (Gem::MissingSpecError)

Checked in 'GEM_PATH=/Users/JinXiaoHao/.rvm/gems/ruby-2.0.0-p648:/Users/JinXiaoHao/.rvm/gems/ruby-2.0.0-p648@global',execute `gem env` for more information

from/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:320:in `to_spec'

from/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'

from /usr/local/bin/pod:22:in `'

这里可以先在终端看下ruby的版本

$ruby -v

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

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

source https://rubygems.org/ not present in cache

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

source https://ruby.taobao.org/ already present in the cache

$gem sources -l

*** CURRENT SOURCES ***

https://ruby.taobao.org/

$ sudo gem installcocoapods

ERROR: Error installing cocoapods:

activesupport requires Ruby version >= 2.2.2.

以上都没有解决问题,下面是重点:

更新ruby,完了之后再去安装pods就可以了

$rvm install 2.2.4

$sudo gem installcocoapods

你可能感兴趣的:(ruby版本低造成Cocoapods出错)