工作这么久,虽然以前也安装过cocoapods,但是自己没有整理,最近有时间重新安装一次,顺便整理下。首先检查Ruby当前版本:
gem sources -
成功后提示:
*** CURRENT SOURCES ***
https://rubygems.org/
替换成国内的源:先要remove当前的ruby: gem sources --remove https://rubygems.org/
先前我们都是添加淘宝的镜像,但是在mac 10.12 系统上面会报错,ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
hostname "upyun.gems.ruby-china.org" does not match the server certificate
这个不能替换成淘宝的,执行下面命令:gem sources -a https://gems.ruby-china.org/
执行下面命令:ruby -v 查看当前版本是否需要升级,ruby需要版本2.0以上,如果小于2.0 则需要升级系统的ruby版本。
执行:rvm list known 如果提示command not found 则运行: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.
代表安装成功
执行:rvm install 2.2.2 安装rvm 里面会直接帮你安装 Downloading and installing Homebrew...
之后就开始安装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
提示安装成功.
网友评论