cocoaPod 安裝和錯誤處理

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)歷過多次報錯直接用改方法, `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)

五:常見的報錯
報錯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

報錯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
報錯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

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


報錯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


報錯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.

解決:存在多個xcode弄痹, xcode-select —install ,后面會彈出一個頁面點擊安裝。



報錯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,我們可以進入/usr/local/Cellar/zlib文件夾后可以查看到
rvm reinstall 2.3.3 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11

報錯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)容合作請聯(lián)系作者
  • 序言:七十年代末邻奠,一起剝皮案震驚了整個濱河市畦韭,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌苗沧,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,277評論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件炭晒,死亡現(xiàn)場離奇詭異待逞,居然都是意外死亡,警方通過查閱死者的電腦和手機网严,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,689評論 3 393
  • 文/潘曉璐 我一進店門识樱,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人震束,你說我怎么就攤上這事怜庸。” “怎么了垢村?”我有些...
    開封第一講書人閱讀 163,624評論 0 353
  • 文/不壞的土叔 我叫張陵割疾,是天一觀的道長。 經(jīng)常有香客問我嘉栓,道長宏榕,這世上最難降的妖魔是什么驰凛? 我笑而不...
    開封第一講書人閱讀 58,356評論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮担扑,結(jié)果婚禮上恰响,老公的妹妹穿的比我還像新娘。我一直安慰自己涌献,他們只是感情好胚宦,可當(dāng)我...
    茶點故事閱讀 67,402評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著燕垃,像睡著了一般枢劝。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上卜壕,一...
    開封第一講書人閱讀 51,292評論 1 301
  • 那天您旁,我揣著相機與錄音,去河邊找鬼轴捎。 笑死鹤盒,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的侦副。 我是一名探鬼主播侦锯,決...
    沈念sama閱讀 40,135評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼秦驯!你這毒婦竟也來了尺碰?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 38,992評論 0 275
  • 序言:老撾萬榮一對情侶失蹤译隘,失蹤者是張志新(化名)和其女友劉穎亲桥,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體固耘,經(jīng)...
    沈念sama閱讀 45,429評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡题篷,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,636評論 3 334
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了玻驻。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片器予。...
    茶點故事閱讀 39,785評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡锯梁,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出麻裁,到底是詐尸還是另有隱情渐夸,我是刑警寧澤嗤锉,帶...
    沈念sama閱讀 35,492評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站墓塌,受9級特大地震影響瘟忱,放射性物質(zhì)發(fā)生泄漏奥额。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,092評論 3 328
  • 文/蒙蒙 一访诱、第九天 我趴在偏房一處隱蔽的房頂上張望垫挨。 院中可真熱鬧,春花似錦触菜、人聲如沸九榔。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,723評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽哲泊。三九已至,卻和暖如春催蝗,著一層夾襖步出監(jiān)牢的瞬間切威,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,858評論 1 269
  • 我被黑心中介騙來泰國打工丙号, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留先朦,地道東北人。 一個月前我還...
    沈念sama閱讀 47,891評論 2 370
  • 正文 我出身青樓犬缨,卻偏偏與公主長得像烙无,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子遍尺,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,713評論 2 354