cocoaPod 安裝和錯(cuò)誤處理

cocoaPod 安裝 Xcode->homebrew->RVM->Ruby->CocoaPods;
一:安裝RVM
1.安裝homeBrew:http://brew.sh/index_zh-cn.html
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.curl -L https://get.rvm.io | bash -s stable 等幾分鐘后
3.source ~/.rvm/scripts/rvm   載入 RVM 環(huán)境
4.rvm -v  檢查一下是否安裝正確

二:安裝ruby
1. rvm list known (列出已知的ruby版本)
2.rvm requirements (rvm 需要那些包)
3. rvm install 2.3.3
4. rvm 2.3.3 --default
5. ruby -v (查看版本)

三:Gem 換ruby-china
1.gem sources -l
2. gem sources --remove XXX
3. gem sources -a https://gems.ruby-china.org

四:安裝cocoapods
1. gem -v (查看版本)
2. sudo gem update --system 
3. sudo gem install -n /usr/local/bin cocoapods
4.配置git config:git config --global http.postBuffer 536870912  (500M)
5. git clone https://coding.net/u/hging/p/Specs/git ~/.cocoapods/repos/master  (經(jīng)歷過多次報(bào)錯(cuò)直接用改方法, `https://coding.net/u/hging/p/Specs/git`已經(jīng)不更新了所以試下`https://github.com/CocoaPods/Specs.git`)
6.pod setup (或者執(zhí)行$ pod repo update $ pod repo)

五:常見的報(bào)錯(cuò)
報(bào)錯(cuò)1
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
解決:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

報(bào)錯(cuò)2
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -9806
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
報(bào)錯(cuò)3
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into 'master'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

解決:報(bào)錯(cuò)2和報(bào)錯(cuò)3 到現(xiàn)在沒有找到特別好的方法,只能 走git clone https://coding.net/u/hging/p/Specs/git ~/.cocoapods/repos/master 然后再pod setup


報(bào)錯(cuò)4: rvm install 2.3.0 :
Error: /usr/local/opt/readline is not a valid keg

Requirements installation failed with status: 1.

 解決:rvm autolibs read-only # read more here:https://rvm.io/rvm/autolibs

rvm install ruby


報(bào)錯(cuò)5: Error running '__rvm_make -j 1',

please read /Users/ikuan/.rvm/log/1504160588_ruby-2.4.1/make.log

There has been an error while running make. Halting the installation.

解決:存在多個(gè)xcode, xcode-select —install ,后面會(huì)彈出一個(gè)頁面點(diǎn)擊安裝。



報(bào)錯(cuò)6. sudo gem update —system

ERROR:  Loading command: update (LoadError)
    cannot load such file -- zlib
ERROR:  While executing gem ... (NoMethodError)
解決:brew install homebrew/dupes/zlib

關(guān)于1.2.11,我們可以進(jìn)入/usr/local/Cellar/zlib文件夾后可以查看到
rvm reinstall 2.3.3 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11

報(bào)錯(cuò)7.
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down


sudo rm -fr ~/.cocoapods/repos/master
git clone https://coding.net/u/hging/p/Specs/git ~/.cocoapods/repos/master
pod setup(或者執(zhí)行$ pod repo update $ pod repo)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容