幫公司新電腦安裝cocopods,遇到了一些坑,總結總結如下
1.移除現有Ruby默認源
$gem sources --remove https://rubygems.org/
2.使用新的源
$gem sources -a https://ruby.taobao.org/
3.驗證新源是否替換成功
$gem sources -l
4.安裝CocoaPods
(1)? $sudo gem install cocoapods 備注:蘋果系統升級 OS X EL Capitan 后改為? $sudo gem install -n /usr/local/bin cocoapods
(2)? $pod setup
5.更新gem
$sudo gem update --system
錯誤1:
Error fetchinghttp://ruby.taobao.org/:
bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
解決方案:把安裝流程中 $gem sources -a http://ruby.taobao.org/? ---改為---->? $gem sources -a https://ruby.taobao.org/
錯誤2:
ERROR:? While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
解決方案:蘋果系統升級OS X EL Capitan后會出現的插件錯誤,將安裝流程 4.安裝CocoaPods 的 (1)sudo gem install cocoapods ——>改為sudo gem install -n /usr/local/bin cocoapods
錯誤3:
[!] Unable to satisfy the following requirements:? - `AVOSCloud (~> 3.1.6.3)` required by `Podfile`
Specs satisfying the `AVOSCloud (~> 3.1.6.3)` dependency were found, but they required a higher minimum deployment target.
解決方案:安裝流程:Podfile文件 中? platform:ios, ‘6.0’? 后邊的 6.0 是平臺版本號 ,一定要加上
錯誤4:activesupport requires Ruby version >= 2.2.2.ruby運行環境版本過低 ,升級ruby版本即可
RVM:Ruby Version Manager,Ruby版本管理器,包括Ruby的版本管理和Gem庫管理(gems)
$ curl -L get.rvm.io | bash -s stable
測試是否安裝正常