安装xcode工具
1xcode-select --install安装rvm
12345curl -L get.rvm.io | bash -s stablervm list known (找到最新的rvm版本)rvm install 2.4
3.改数据源123gem sources -a https://gems.ruby-china.orggem sources --remove https://rubygems.org/
安装rails
1sudo gem install rails安装cocoapods
1sudo gem install cocoapods
在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 即可