在我們大天朝,使用網(wǎng)絡(luò)都是被監(jiān)控的,我們安裝cocopods的時(shí)候之前都會(huì)從網(wǎng)上搜索很多解決辦法,但是發(fā)現(xiàn)新的https://ruby.taobao.org/已經(jīng)不再維護(hù)了。所以我們?cè)诎惭b的時(shí)候會(huì)一直遇到證書(shū)問(wèn)題。同時(shí)我們公司的網(wǎng)絡(luò)同樣存在動(dòng)態(tài)修改用戶host的功能(這個(gè)好像有),所以被迫使用新的網(wǎng)絡(luò),然后將錯(cuò)誤提示和新的請(qǐng)求辦法貼出來(lái)。
執(zhí)行sudo gem install cocoapods的時(shí)候提示錯(cuò)誤
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)
其實(shí)只要是使用gem的都會(huì)又ssl證書(shū)問(wèn)題。
下面說(shuō)下用的新路徑
gem sources --remove https://ruby.taobao.org/
gem sources -a https://gems.ruby-china.org/
gem sources -l
sudo gem install -n /usr/local/bin cocoapods
然后就會(huì)執(zhí)行成功了,不過(guò)此刻會(huì)卡住,其實(shí)是在下載文件,你可以用下面的方法查看下載的文件大小。
cd ~/.cocoapods/
du -sh *
到此就可以說(shuō)是解決了這個(gè)問(wèn)題了。