1.Ruby默認源
0. 查看當前ruby源:gem sources -l
1. ruby默認的源和淘寶的源https://ruby.taobao.org/ 都已經不能使用。我們要移除掉這些不能用的ruby源。
?gem sources --r https://ruby.taobao.org/
2. 使用新的源 https://gems.ruby-china.org/
? gem sources -a https://gems.ruby-china.org/
3. 驗證新源是否替換成功
? gem sources -l
如果有其他的地址存在,要刪除(gem sources --r),最后只留下https://gems.ruby-china.org/
2.安裝cocoapods
sudo gem install -n /usr/local/bin cocoapods? ? //OS X EL Capitan以前系統可以使用sudo gem install cocoapods指令
3.報錯調整
1.ERROR:? While executing gem … (Gem::DependencyError) Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.2.0), cocoapods-downloader (< 2.0, >= 1.1.3), cocoapods-trunk (< 2.0, >= 1.1.2), molinillo (~> 0.5.5), xcodeproj (< 2.0, >= 1.4.1); activesupport requires thread_safe (>= 0.3.4, ~> 0.3); tzinfo requires thread_safe (~> 0.1)
解決辦法:gem update --system
2.ruby源已經確認沒問題,但是還是會報一個地址的錯誤。While executing gem…(OpenSSL::SSL::SSLError)hostname“upyun.gems.ruby-china.org”doesnotmatch the server certificate
解決辦法:gem sources --remove 報錯的http地址upyun.gems.ruby-china.org
3.ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod
解決辦法:蘋果系統升級OS X EL Capitan后會出現的插件錯誤,將安裝指令 sudo gem install cocoapods ——>改為sudo gem install -n /usr/local/bin cocoapods