工作這么久,雖然以前也安裝過(guò)cocoapods涌献,但是自己沒(méi)有整理胚宦,最近有時(shí)間重新安裝一次,順便整理下燕垃。首先檢查Ruby當(dāng)前版本:
gem sources -
成功后提示:
*** CURRENT SOURCES ***
https://rubygems.org/
替換成國(guó)內(nèi)的源:先要remove當(dāng)前的ruby: gem sources --remove https://rubygems.org/
先前我們都是添加淘寶的鏡像枢劝,但是在mac 10.12 系統(tǒng)上面會(huì)報(bào)錯(cuò),ERROR:? While executing gem ... (OpenSSL::SSL::SSLError)
hostname "upyun.gems.ruby-china.org" does not match the server certificate
這個(gè)不能替換成淘寶的卜壕,執(zhí)行下面命令:gem sources -a https://gems.ruby-china.org/
執(zhí)行下面命令:ruby -v 查看當(dāng)前版本是否需要升級(jí)您旁,ruby需要版本2.0以上,如果小于2.0 則需要升級(jí)系統(tǒng)的ruby版本轴捎。
執(zhí)行:rvm list known 如果提示command not found 則運(yùn)行:curl -L get.rvm.io | bash -s stable
如果提示
# ponted,
#
#? Thank you for using RVM!
#? We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
Upgrade Notes:
* No new notes to display.
代表安裝成功
執(zhí)行:rvm install 2.2.2 安裝rvm? 里面會(huì)直接幫你安裝 Downloading and installing Homebrew...
之后就開(kāi)始安裝cocoapods:sudo gem install cocoapods
Done installing documentation for i18n, thread_safe, tzinfo, activesupport, claide, fuzzy_match, nap, cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, netrc, cocoapods-trunk, cocoapods-try, colored2, escape, fourflusher, gh_inspector, molinillo, ruby-macho, CFPropertyList, nanaimo, xcodeproj, cocoapods after 17 seconds
26 gems installed
提示安裝成功.