1、最近在使用cocoapods时出现下面的报错:
ERROR: SSL verification error at depth 0: certificate has expired (10)ERROR: Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR: SSL verification error at depth 0: certificate has expired (10)ERROR: Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR: SSL verification error at depth 0: certificate has expired (10)ERROR: Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR: Could not find a valid gem 'cocoapods' (= 1.5.0), here is why: Unable to download data from https://ruby.taobao.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired) (https://ruby.taobao.org/specs.4.8.gz)ERROR: SSL verification error at depth 0: certificate has expired (10)ERROR: Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02ZERROR: SSL verification error at depth 0: certificate has expired (10)ERROR: Certificate /C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.taobao.org expired at 2018-12-05T03:16:02Z
出现这个的原因是因为原来淘宝的ruby源无法使用了
我们先删除原来的ruby源:gem sources --remove https://ruby.taobao.org/
然后添加新的ruby源: gem sources -a https://gems.ruby-china.com/
gem sources 查看当前ruby源状态是否替换成功
最后 sudo gem install -n /usr/local/bin cocoapods -v 1.5.3(任意版本)升级或降级到自己需要的版本
2、什么是gem
Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/)源来查找、安装、升级和卸载软件包,非常的便捷。
常用的命令有:
$ gem --version (查看gem版本)
$ gem update --system(更新gem)
$ gem sources (查看数据源)
$ gem sources --remove https://rubygems.org/(删除数据源)
$ gem sources -a https://ruby.taobao.org/(添加数据源)
$ gem search 软件包关键字(搜索软件包)
$ gem install 软件包名称(安装软件包)
$ gem install cocoapods --pre(安装上一个版本软件包)
$ gem uninstall 软件包名称(卸载安装包)
网友评论