Cocoapods的安裝步驟
1. ctrl +空格: 開啟iTerm2
2. 查看Ruby源:gem sources -l
3. 移除默認(rèn)Ruby源:gem sources --remove https://rubygems.org/
4. 使用新的源:gem sources -a https://ruby.taobao.org/
5. 驗(yàn)證源是否替換成功:gem sources -l
6. 安裝rvm:curl -L get.rvm.io | bash -s stable
7. 加載修改后的設(shè)置:source?~/.bashrc
8. 讓修改后的設(shè)置立即生效:source?~/.bash_profile ?
9. 查看是否安裝成功:rvm -v
10. 獲取Homebrew :/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
11. 查看是否安裝成功:ruby -v
12. 顯示隱藏文件:defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
13. ?打開ruby所在目錄:Finder -> cmd+shift+G -> ~/.rvm -> archives
14. 刪除archives文件夾下的低版本Ruby,添加2.3.0版本的ruby壓縮包
15. 安裝高版本的Ruby:rvm install 2.3.0
16. 下載cocoapods:sudo gem install cocoapods
網(wǎng)速不好的時(shí)候使用
(17.打開Finder -> cmd+shift+G -> ~/.cocoapods
18. 刪除cocoapods下的repos文件夾, 添加準(zhǔn)備好的repos)
19. 初始化cocoapods:pod setup
Cocoapods的使用
1.pod init生成Podfile文件
2. open Podfile
3. 在Podfile文件中添加第三方庫抓艳,到GitHub官網(wǎng)查看第三方庫的Readme.md文件中的書寫格式pod ‘AFNetworking’ ‘~> 3.0’
4. pod install
5.pod update --verbose --no-repo-update