1、更新RubyGems
sudo gem update -n /usr/local/bin --system
2、ruby换源
sudo gem source --add https://gems.ruby-china.com/
sudo gem source --remove https://rubygems.org/
3、安装Cocoapods
sudo gem install -n /usr/local/bin cocoapods
4、配置Cocoapods
pod setup
Note: 在执行命令的过程中会出现和SSL相关的错误,但是不需要处理,cocoapods也是能够正常安装和配置