安装gem
- 使用sudo系统管理命令,更新gem(在安装CocoaPods之前,首先要在本地安装好Ruby环境。(MAC一般自带))
$ sudo gem update --system
这里请翻墙一下
- 查看gem版本
$ gem -v
2.6.8
请尽可能用比较新的 RubyGems 版本,建议 2.6.x 以上。如果不是用上一步命令更新
- 使用rubychina的源更新,淘宝的源已经不在更新。详情:https://ruby-china.org/topics/29250
$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.org
# 确保只有 gems.ruby-china.org
删除原先的镜像元,添加rubyChina的源 最后确保只有rubyChina的源
更新CocoaPod
- 在mac终端运行
$ sudo gem install cocoapods
在这里遇到了这个错误
ERROR: SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR: You must add /C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority to your local trusted store
ERROR: SSL verification error at depth 2: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)
解决方法:
$ sudo gem install -n /usr/local/bin cocoapods
or
$ sudo gem install -n /usr/local/bin GEM_NAME_HERE
- 查看一下各种信息,完成pod就可以使用了
$ gem list
我的输出结果是这样的
*** LOCAL GEMS ***
activesupport (4.2.7.1)
bigdecimal (default: 1.2.0)
CFPropertyList (2.3.3, 2.2.8)
claide (1.0.1)
cocoapods (1.1.1)
cocoapods-core (1.1.1)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.1.1)
cocoapods-try (1.1.0)
colored (1.2)
是1.1.1版本的pod
相关及一些问题的链接:
ffbye/article/details/51527217
https://segmentfault.com/q/1010000002926243
http://www.qingpingshan.com/pc/fwq/165342.html
http://www.skyfox.org/ruby-gems-update.html
http://blog.it985.com/18645.html