1.在装之前最好先卸载点老版本
$ sudo gem uninstall cocoapods
2.查看本地安装过的cocopods相关东西
$ gem list --local | grep cocoapods
显示如下:
cocoapods (1.0.1)
cocoapods-core (1.0.1)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.0.0)
cocoapods-try (1.1.0)
然后使用命令逐个删除
$ sudo gem uninstall cocoapods-core
$ sudo gem uninstall cocoapods-deintegrate
....
最后都移除之后,cocoapods就被移除了,然后再通过命令重新安装
1.添加淘宝镜像:
gem source -a https://ruby.taobao.org/
sudo gem install -n /usr/local/bin cocoapods
2.sudo gem install cocoapods
3.pod setup
Terminal会停留在 Setting up CocoaPods master repo 这个状态一段时间,是因为要进行下载安装,而且目录比较大,需要耐心等待一下
看到最后一条 gems installed 表示安装成功了