CocoaPods的安装及使用
1.首先安装RVM
1.1打开终端$ curl -L https://get.rvm.io | bash -s stable



1.2然后,载入 RVM 环境$ source ~/.rvm/scripts/rvm
1.3检查是否安装正确$ rvm -v

2.安装 Ruby 环境
2.1查找现有版本$ rvm list known
选择现有的版本来进行安装(网络不好漫长的等待)$ rvm install 2.2.4

2.2安装成功后需要进行设置为默认$ rvm 2.2.4 --default
2.3测试是否正确$ ruby -v

2.4$ gem -v
2.5默认源替换成淘宝的
$gem source -r https://rubygems.org/
$ gem source -a https://ruby.taobao.org
2.6验证是否成功$ gem sources -l

3.CocoaPods的安装
3.1运行$ sudo gem install cocoa pods(期间会让你输入本机密码)

3.2更新CocoaPods$ sudo gem update cocoa pods
3.3项目里添加CocoaPods:cd + 路径进入我们的项目(直接拖我们的文件夹)
3.4利用vim创建Podfile$ vim Podfile

按下esc,然后输入wq进行保存退出
3.5输入$ pod install

最终成功

参考:CocoaPods安装和使用教程以及RVM、RuBy的安装配置 - CSDN博客
在使用pod install/pod update更ai新很慢,原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update