Mac CocoaPods 安装

CocoaPods 环境

CocoaPods是使用Ruby语言写的,因此须要Ruby的支持,mac自带Rubygit

因为操做系统的安全问题,苹果禁止升级系统的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 镜像

阿里云 Rubygems 开源镜像阿里云

gem source -r https://rubygems.org/
gem source -a http://mirrors.aliyun.com/rubygems/

安装CocoaPods

# Xcode 8 + 9
$ sudo gem install cocoapods //有的版本的系统不须要sudo权限

修改 CocoaPods 镜像

这里我使用清华大学开源软件镜像站,如下是该镜像站的使用说明操作系统

清华大学开源 CocoaPods 镜像使用帮助code

$ 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

据说 CocoaPods 有个APP,不想折腾了,不知道能不能修改索引,改为国内的镜像,这样就少折腾点rem

不过这不是正常的路啊!

相关文章
相关标签/搜索