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 环境
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  (经历过多次报错直接用改方法, `https://coding.net/u/hging/p/Specs/git`已经不更新了所以试下`https://github.com/CocoaPods/Specs.git`)
6.pod setup (或者执行$ 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 到现在没有找到特别好的方法,只能 走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

关于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(或者执行$ pod repo update $ pod repo)

你可能感兴趣的:(cocoaPod 安装和错误处理)