CocoaPod 安装使用rubyChina的源

安装gem

  1. 使用sudo系统管理命令,更新gem(在安装CocoaPods之前,首先要在本地安装好Ruby环境。(MAC一般自带))
$ sudo gem update --system 

这里请翻墙一下

  1. 查看gem版本
$ gem -v
2.6.8

请尽可能用比较新的 RubyGems 版本,建议 2.6.x 以上。如果不是用上一步命令更新

  1. 使用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

  1. 在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
  1. 查看一下各种信息,完成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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容