等待進度完成后查看 cocoapods的版本
$ pod --version
新建工程姓言,并在終端用 cd 指令到文件夾內(nèi)
$ pod search 第三方
輸入過后它可能會報:
[!] Unable to find a pod with name, author, summary, or descriptionmatching `AFNetworking`
解決方案是:
輸入:
rm ~/Library/Caches/CocoaPods/search_index.json
后在一次輸入:pod search AFNetworking
1.開啟 terminal
2.移除現(xiàn)有 Ruby 默認源
$ gem sources --remove https://rubygems.org/
3.使用新的源
$ gem sources -a https://ruby.taobao.org/
4.驗證新源是否替換成功
$ gem sources -l
5.安裝 CocoaPods
$ sudo gem install cocoapods
$ pod setup
iOS 最新版 CocoaPods 的安裝流程
1.移除現(xiàn)有Ruby默認源
$gem sources --remove https://rubygems.org/
2.使用新的源
$gem sources -a https://ruby.taobao.org/
3.驗證新源是否替換成功
$gem sources -l
提示
*** CURRENT SOURCES ***
https://ruby.taobao.org/
證明安裝成功
4.安裝CocoaPods
(1)$sudo gem install -n /usr/local/bin cocoapods
在此出現(xiàn)安裝錯誤的提示
ERROR:Error installing cocoapods:
activesupport requires Ruby version >=2.2.2.
意思是我的ruby的版本小于2.2.2不能進行安裝cocoapods
到此只能升級ruby,升級ruby步驟如下
1、先安裝 RVM
RVM:Ruby Version Manager,Ruby版本管理器,包括Ruby的版本管理和Gem庫管理(gemset)
$ curl -L get.rvm.io | bash -s stable
安裝成功后檢測RVM
$ source ~/.bashrc
$source ~/.bash_profile
$ rvm -v
提示
rvm1.27.0(latest) by Wayne E. Seguin , Michal Papis [https://rvm.io/]
安裝成功
2 升級ruby
先獲取列表的版本信息
$ rvm list known
3 找到 ruby的版本信息,進行安裝
# Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx[-2.5.8]
rbx-head
根據(jù)提示得知目前存在的版本: 1.4.3---2.3.0---2.4.1---2.5.8
通過安裝 (已經(jīng)進行翻墻操作)發(fā)現(xiàn)2.4.1總是提示404后來 選擇安裝2.3.0版本至于為什么不選擇2.5.8你懂得.
安裝 2.3.0版本
$ rvm install 2.3.0
下面就是一堆的進度條,操作漫長,等等中......
等待完成后查看當前ruby版本
$ ruby -v
提示
ruby2.3.0p0 (2015-12-25revision53290) [x86_64-darwin15]
證明已經(jīng)升級成功了
下面就可以正式安裝CocoaPodsle
4.2安裝CocoaPods
$ sudo gem install cocoapods
$sudo gem install -n /usr/local/bin cocoapods
$pod setup
5.? 更新 gem
$sudo gem update --system
等待進度完成后查看 cocoapods的版本
$ pod --version
提示
1.0.1
到此cocoapods安裝成功,