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)
cocoaPod 安裝和錯誤處理
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進店門识樱,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人震束,你說我怎么就攤上這事怜庸。” “怎么了垢村?”我有些...
- 文/不壞的土叔 我叫張陵割疾,是天一觀的道長。 經(jīng)常有香客問我嘉栓,道長宏榕,這世上最難降的妖魔是什么驰凛? 我笑而不...
- 正文 為了忘掉前任,我火速辦了婚禮担扑,結(jié)果婚禮上恰响,老公的妹妹穿的比我還像新娘。我一直安慰自己涌献,他們只是感情好胚宦,可當(dāng)我...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著燕垃,像睡著了一般枢劝。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上卜壕,一...
- 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼秦驯!你這毒婦竟也來了尺碰?” 一聲冷哼從身側(cè)響起,我...
- 正文 年R本政府宣布,位于F島的核電站墓塌,受9級特大地震影響瘟忱,放射性物質(zhì)發(fā)生泄漏奥额。R本人自食惡果不足惜,卻給世界環(huán)境...
- 文/蒙蒙 一访诱、第九天 我趴在偏房一處隱蔽的房頂上張望垫挨。 院中可真熱鬧,春花似錦触菜、人聲如沸九榔。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽哲泊。三九已至,卻和暖如春催蝗,著一層夾襖步出監(jiān)牢的瞬間切威,已是汗流浹背。 一陣腳步聲響...