https://www.jianshu.com/p/ab6411a05bc2
1. 更换源
sudo gem update --system
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
2.正式安装
在cocoapods 执行
sudo gem install cocoapods
的时候出现 While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
改为 sudo gem install -n /usr/local/bin cocoapods 即可