CocoaPods
是使用Ruby
语言写的,因此须要Ruby
的支持,mac自带Ruby
。git
因为操做系统的安全问题,苹果禁止升级系统的Ruby
,其实也没有这个必要,只要是系统版本比较新的,自带的软件版本都会比较新。安全
若是非要用最新版本的Ruby
,可用经过Homebrew
安装另一个Ruby
,这样就不会和系统的有冲突了。ruby
CocoaPods is built with Ruby and is installable with the default Ruby available on OS X. We recommend you use the default Ruby.ide
Using the default Ruby install can require you to use sudo when installing gems. Further installation instructions are in the guides.ui
gem source -r https://rubygems.org/ gem source -a http://mirrors.aliyun.com/rubygems/
# Xcode 8 + 9 $ sudo gem install cocoapods //有的版本的系统不须要sudo权限
这里我使用清华大学开源软件镜像站,如下是该镜像站的使用说明操作系统
$ cd ~/.cocoapods/repos $ pod repo remove master $ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
最后进入本身的工程,在本身工程的podFile第一行加上:索引
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
据说 CocoaPods 有个APP,不想折腾了,不知道能不能修改索引,改为国内的镜像,这样就少折腾点rem
不过这不是正常的路啊!