和往常一样使用 Cocoapods ,执行命令:
$ pod install
#输出信息
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'cocoapods' (>= 0) among 59 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/local/bin/pod:22:in `<main>'
查看 Ruby
版本:
$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
看来是升级 Ruby 2.2.3
导致的问题,更新下 Cocoapods 即可,更新步骤:
1、 更新 gem ,国内需切换 gem source
$ sudo gem update --system
- 切换
gem source
$ gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
$ gem sources -l
*** CURRENT SOURCES***
https://ruby.taobao.org
2、 安装 cocoapods
$ sudo gem install cocoapods
$ pod setup
和安装过程是一样的,再次查看 pod
版本:
$ pod --version
0.39.0