gem install – error : Connection reset by peer

sudo gem install cocoapods

ERROR:  Could not find a valid gem ‘cocoapods’ (>= 0), here is why:

          Unable to download data from https://rubygems.org/ – Errno::ECONNRESET: Connection reset by peer – SSL_connect (https://rubygems.org/latest_specs.4.8.gz)

上面这个错误可能是由于GFW引起了, 所以把source rubygems.org改成baobao.com就可以了

$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org

更多详情见 https://ruby.taobao.org/