1、安装homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2、安装ruby
brew install ruby
替换为国内源
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
检查是否替换成功
gem sources -l
3、安装cocopods
sudo gem install -n /usr/local/bin cocoapods