1.查詢 rvm版本
rvm -v
2.查詢ruby版本
ruby -v
3.查詢 gem 版本
gem -v
4.查詢ruby 鏡像
gem sources -l
5.升級ruby環(huán)境到 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 ***
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 查詢一下版本 但是 我自己的電腦 出現(xiàn)了
/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 `’
這個錯誤
公司的電腦出現(xiàn)了
/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 `<top(required)>’
這個錯誤
我就先把 gem 版本升級了
gem update —system
然后查看 gem -v
pengdunshiyoudeiMac:local pdsy$ gem -v
2.6.8
這時候 我從網(wǎng)上看到一位朋友給的解決辦法 我就粘貼了試了試 下面是我公司電腦出的錯誤 , 上面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 `’
現(xiàn)找一下 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