更新ruby镜像遇到OpenSSL证书过期的问题

最近升级cocoapods中发现在更新ruby镜像源的时候遇见ssl证书链接错误的情况,

https://gems.ruby-china.org/已经访问不了,需要替换新的镜像

 

首先将查看自己的镜像
 

gem sources -l

再讲之前的镜像删除

//我自己电脑上是https://gems.ruby-china.org/,所以删除该镜像
gem sources --remove https://gems.ruby-china.org/

然后添加新的镜像

gem sources --add https://gems.ruby-china.com/

这个时候开始报错ssl证书错误

ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Error fetching https://gems.ruby-china.com/:
    SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://gems.ruby-china.com/specs.4.8.gz)

这时候需要检查自己的OpenSSL正式是否过期

rvm osx-ssl-certs

效果:Certificates for ~/Documents/ssldir/~/Documents/ssldir/cert.pem: Old.

这时候更新OpenSSL证书

rvm osx-ssl-certs update all
效果如下:
Updating certificates for ~/Documents/ssldir/~/Documents/ssldir/cert.pem: Updating certificates in '~/Documents/ssldir/~/Documents/ssldir/cert.pem'.
Updated.

然后再次添加新的镜像

gem sources --add https://gems.ruby-china.com/
https://gems.ruby-china.com/ added to sources
//再次检查
xxxMacBook-Pro:~ maxuan$ gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/

 


版权声明:本文为mx666666原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。