问题:安装cocoapods 报SSL证书的问题,如下错误
ERROR: SSL verification error at depth 2: self-signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services)
ERROR: SSL verification error at depth 2: self-signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root CA)
Successfully installed cocoapods-1.11.2
Parsing documentation for cocoapods-1.11.2
Done installing documentation for cocoapods after 1 seconds
1 gem installed
[!] Couldn't determine repo type for URL: `https://cdn.cocoapods.org/`: SSL_connect returned=1 errno=0 peeraddr=172.67.74.167:443 state=error: certificate verify failed (unable to get local issuer certificate)
解决方案:
1.下载证书
可以使用 wget 下载或者直接在网页下载
https://curl.se/ca/cacert.pem
2.设置环境变量
vim /etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
# 设置环境变量的路径,/root/cacert.pem为下载证书后放的位置
export SSL_CERT_FILE=/root/cacert.pem
source /etc/profile
3.安装cocoapods,指定版本1.11.2
sudo gem install -n /usr/local/bin cocoapods -v 1.11.2
注释:使用gem安装问题有点小多,如果不需要指定版本可以选择brew安装最新的版本。终端输入 : brew install cocoapods 即可
标签:certificate,1.11,证书,SSL,ERROR,cocoapods,etc From: https://www.cnblogs.com/r360/p/17461415.html