升級(jí) OS X El Capitan 后堵幽,Time Machine 恢復(fù)下,隨后因?yàn)橛龅?octopress 無法更新博客問題冤议,一番折騰 octopress 適配了 OS X El Capitan猜丹,然而事情總沒有那么簡(jiǎn)單卤唉,又丟過來一個(gè)問題。
和往常一樣使用 Cocoapods 低飒,執(zhí)行命令:
$ 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]
看來是升級(jí) Ruby 2.2.3
導(dǎo)致的問題许昨,更新下 Cocoapods 即可,更新步驟:
1褥赊、 更新 gem 糕档,國(guó)內(nèi)需切換 gem source
$ sudo gem update --system
- 切換
gem source
$ gem sources --add https://gems.ruby-china.com --remove https://rubygems.org/
$ gem sources -l
*** CURRENT SOURCES***
https://gems.ruby-china.org
2、 安裝 cocoapods
$ sudo gem install cocoapods
$ pod setup
#mac osx 10.11 之后
$ sudo gem install -n /usr/local/bin cocoapods --pre //安裝最新版本
$ sudo gem install -n /usr/local/bin cocoapods -v <version> //安裝指定的 version
和安裝過程是一樣的拌喉,再次查看 pod
版本:
$ pod --version
0.39.0
搞定~