1.查询 rvm版本
rvm -v
2.查询ruby版本
ruby -v
3.查询 gem 版本
gem -v
4.查询ruby 镜像
gem sources -l
5.升级ruby环境到 2.2.2 ,
rvm install ruby 2.2.2
6.再次查询 看看升级成功
pengdunshiyoudeiMac:~ pdsy$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
7.查询镜像
pengdunshiyoudeiMac:~ pdsy$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
8.更换镜像地址 成腾讯云 淘宝镜像好像不行了
pengdunshiyoudeiMac:~ pdsy$ gem sources --removehttps://ruby.taobao.org/
https://ruby.taobao.org/removed from sources
pengdunshiyoudeiMac:~ pdsy$ gem sources -ahttp://gems.ruby-china.org/
http://gems.ruby-china.org/added to sources
9.最后升级 cocoaPods
pengdunshiyoudeiMac:~ pdsy$ sudo gem install -n /usr/local/bin cocoa pods//这个地方不能用之前旧的更新方法:sudo gem installcocoa pods
如果成功以后 可以 pod —version 查询一下版本 但是 我自己的电脑 出现了
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
from /usr/local/bin/pod:22:in `’
这个错误
公司的电脑出现了
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- utils/popen (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/utils.rb:6:in `
这个错误
我就先把 gem 版本升级了
gem update —system
然后查看 gem -v
pengdunshiyoudeiMac:local pdsy$ gem -v
2.6.8
这时候 我从网上看到一位朋友给的解决办法 我就粘贴了试了试 下面是我公司电脑出的错误 , 上面2个错误的解决办法是一样的
/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 25 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 `’
现找一下 pod的路径
pengdunshiyoudeiMac:local pdsy$ which pod
/usr/local/bin/pod
删除目录下的文件
pengdunshiyoudeiMac:local pdsy$ sudo rm -rf /usr/local/bin/pod
Password:
获取gem
pengdunshiyoudeiMac:local pdsy$ gem list
*** LOCAL GEMS ***
activesupport (5.0.0.1)
bigdecimal (default: 1.2.6)
bundler-unload (1.0.2)
cocoa (0.1.6)
concurrent-ruby (1.0.2)
executable-hooks (1.3.2)
ffi (1.9.14)
gem-wrappers (1.2.7)
i18n (0.7.0)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (5.4.3)
pods (0.0.1)
power_assert (0.2.2)
psych (default: 2.0.8)
rake (default: 10.4.2)
rdoc (default: 4.2.0)
rubygems-bundler (1.4.4)
rubygems-update (2.6.8)
rvm (1.11.3.9)
test-unit (3.0.8)
thread_safe (0.3.5)
tzinfo (1.2.2)
移除程序包
pengdunshiyoudeiMac:local pdsy$ gem uninstall cocoapods -v 0.39.0
pengdunshiyoudeiMac:local pdsy$ gem uninstall cocoapods-core -v 0.39.0
在这里我没有输出 正常的会有输出
Successfully uninstalled cocoapods-0.39.0
Successfully uninstalled cocoapods-core-0.39.0
然后下面我直接安装了cocoapod
pengdunshiyoudeiMac:local pdsy$ sudo gem install cocoapods
然后下面是安装过程
………….Done installing documentation for nanaimo, colored, claide, CFPropertyList, activesupport, xcodeproj, nap, molinillo, gh_inspector, fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after 15 seconds
22 gems installed
最后检查一下版本
pengdunshiyoudeiMac:local pdsy$ pod --version
1.1.1
最终完成了
最后添加几个参考地址:
http://blog.csdn.net/xingxingrainlove/article/details/53257944
http://www.cocoachina.com/bbs/read.php?tid-1678150.html
http://blog.csdn.net/wangyanchang21/article/details/51885383