cocoapods安装SSL证书问题
问题:安装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 即可
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2022-06-06 iOS全埋点解决方案-数据同步
2018-06-06 UITableView的headerView和headerInsectionView
2018-06-06 Mac下载软件的网站