CocoaPods系列 - 安装
2016-04-16 本文已影响53人
邓俊杰
打开终端,修改源并下载安装。
gem sources -l // 查看源列表
gem sources -remove https://rubygems.org/ // 将不需要的源移除掉
gem sources -a https://ruby.taobao.org/ // 添加淘宝源(当然你有其他可用的源也可以)
sudo gem install cocoapods // 安装cocoapods
输入完之后可能需要输入用户密码,输入密码后按回车即可。
Password:
如果一切正常,会显示安装进度,完成后即可使用CocoaPods。
Fetching: nap-1.1.0.gem (100%)
Successfully installed nap-1.1.0
Fetching: cocoapods-core-1.0.0.beta.8.gem (100%)
Successfully installed cocoapods-core-1.0.0.beta.8
Fetching: claide-1.0.0.beta.3.gem (100%)
Successfully installed claide-1.0.0.beta.3
Fetching: cocoapods-deintegrate-1.0.0.beta.1.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.0.beta.1
Fetching: cocoapods-downloader-1.0.0.beta.3.gem (100%)
Successfully installed cocoapods-downloader-1.0.0.beta.3
Fetching: cocoapods-plugins-1.0.0.beta.1.gem (100%)
Successfully installed cocoapods-plugins-1.0.0.beta.1
Fetching: cocoapods-search-1.0.0.beta.2.gem (100%)
Successfully installed cocoapods-search-1.0.0.beta.2
...(太长就不全部贴出来了)
安装过程中可能遇到的问题:
- 早期网上的安装教程用http协议的淘宝源
http://ruby.taobao.org/
,但是淘宝已经更新为https协议了,所以报错。将源修改为https即可。
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz)
- 我从0.38更新到最新版本,会报错。使用以下指令来安装即可。
sudo gem install -n /usr/local/bin cocoapods
附问题链接:http://stackoverflow.com/questions/32810808/can-not-perform-pod-install-under-el-capitan-15a279b