1. 程式人生 > >cocoapods 更新

cocoapods 更新

索引 log sea 成功 div system gem 2.3 rmi

總共就下面幾個命令行

sudo gem update --system
gem sources --remove https://rubygems.or
gem source -a https://gems.ruby-china.org/
sudo gem install -n /usr/local/bin cocoapods
pod setup
pod --version
pod search AFNetWorking

升級Ruby環境

gem update --system
若報錯 
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

則把上面的命令行換成
sudo gem update --system

更換Ruby鏡像

// 檢查現有 Ruby鏡像
gem sources -l
如果結果是 
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
就不需要替換了,否則就要替換,執行下面命令
// 移除現有鏡像
gem sources --remove https://rubygems.or
// 添加國內鏡像
gem source -a https://gems.ruby-china.org/
// 檢查是否替換成功
gem sources -l

安裝 Cocoapods

sudo gem install cocoapods
若出現
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.
則換成下面的命令行
sudo gem install -n /usr/local/bin cocoapods

建立索引庫

pod setup

查看版本

pod --version

cocoapods 更新