1、检查版本
sudo gem update --system
Password:
ERROR: SSL verification error at depth 0: ok (0)
2、查看镜像路径
gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
是淘宝,然后执行安装命令
sudo gem install cocoapods
结果不成功,log如下:
ERROR: SSL verification error at depth 0: ok (0)
ERROR: SSL verification error at depth 0: ok (0)
ERROR: SSL verification error at depth 0: ok (0)
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://ruby.taobao.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (certificate rejected) (https://ruby.taobao.org/specs.4.8.gz)
4、淘宝的镜像关闭了,切换到腾讯的。
删除原来的镜像路径gem sources --remove https://ruby.taobao.org/,改成 gem sources -a http://gems.ruby-china.org/,结果还是不行。log如下
Error fetching http://gems.ruby-china.org/:
no such name (http://gems.ruby-china.org/specs.4.8.gz)
5、直接执行:sudo gem install cocoapods
ERROR: Could not find a valid gem 'cocoapods' (>= 0) in any repository,又不行,额……
5、弄个梯子,执行:sudo gem install cocoapods --source http://rubygems.org
log如下:
Parsing documentation for cocoapods-1.11.2
Installing ri documentation for cocoapods-1.11.2
Done installing documentation for concurrent-ruby, i18n, tzinfo, zeitwerk, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, public_suffix, addressable, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-trunk, cocoapods-try, molinillo, atomos, colored2, nanaimo, rexml, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 61 seconds
34 gems installed
6、执行gem source -l
*** CURRENT SOURCES ***
7、pod setup
log如下
Setup completed
8、检查是否安装成功,pod search AFNetworking
log如下
Setup completed
Creating search index for spec repo 'master'.. Done!
按q键退出