CocoaPods最新版本升級

城北陶公發表於2018-04-13

升級CocoaPods的步驟和安裝的時候差不多,具體參考如下步驟:

1. 首先我們可以檢視下當前的版本號命令如下:

pod --version

1.2.0 // 本機安裝的版本
複製程式碼

2. 在升級之前我們需要了解當前安裝的Ruby源地址:

gem source -l

*** CURRENT SOURCES ***

http://rubygems.org/
https://gems.ruby-china.org/
https://ruby.taobao.org/
複製程式碼

上面我已經新增過新的源

3. 移除淘寶的Ruby源,新增一個新的源(注意:目前淘寶的源已經不能用了)

// 移除舊的源
gem sources --remove https://ruby.taobao.org/
https://ruby.taobao.org/ removed from sources

// 新增新的源
gem sources -a https://gems.ruby-china.org/
// 因為已經新增過了
source https://gems.ruby-china.org/ already present in the cache
複製程式碼

4. 檢視新的源是否新增成功,使用的命令和步驟2一樣

gem source -l

*** CURRENT SOURCES ***

https://gems.ruby-china.org/
複製程式碼

5. 開始安裝,輸入如下命令:

sudo gem install cocoapods

Password:
Fetching: cocoapods-core-1.5.0.gem (100%)
Successfully installed cocoapods-core-1.5.0
Fetching: claide-1.0.2.gem (100%)
Successfully installed claide-1.0.2
Fetching: cocoapods-deintegrate-1.0.2.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.2
Fetching: cocoapods-downloader-1.2.0.gem (100%)
Successfully installed cocoapods-downloader-1.2.0
Fetching: netrc-0.11.0.gem (100%)
Successfully installed netrc-0.11.0
Fetching: cocoapods-trunk-1.3.0.gem (100%)
Successfully installed cocoapods-trunk-1.3.0
Fetching: molinillo-0.6.5.gem (100%)
Successfully installed molinillo-0.6.5
Fetching: atomos-0.1.2.gem (100%)
Successfully installed atomos-0.1.2
Fetching: colored2-3.1.2.gem (100%)
Successfully installed colored2-3.1.2
Fetching: nanaimo-0.2.5.gem (100%)
Successfully installed nanaimo-0.2.5
Fetching: xcodeproj-1.5.7.gem (100%)
Successfully installed xcodeproj-1.5.7
Fetching: ruby-macho-1.1.0.gem (100%)
Successfully installed ruby-macho-1.1.0
Fetching: cocoapods-1.5.0.gem (100%)
Successfully installed cocoapods-1.5.0
Parsing documentation for cocoapods-core-1.5.0
Installing ri documentation for cocoapods-core-1.5.0
Parsing documentation for claide-1.0.2
Installing ri documentation for claide-1.0.2
Parsing documentation for cocoapods-deintegrate-1.0.2
Installing ri documentation for cocoapods-deintegrate-1.0.2
Parsing documentation for cocoapods-downloader-1.2.0
Installing ri documentation for cocoapods-downloader-1.2.0
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for cocoapods-trunk-1.3.0
Installing ri documentation for cocoapods-trunk-1.3.0
Parsing documentation for molinillo-0.6.5
Installing ri documentation for molinillo-0.6.5
Parsing documentation for atomos-0.1.2
Installing ri documentation for atomos-0.1.2
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for nanaimo-0.2.5
Installing ri documentation for nanaimo-0.2.5
Parsing documentation for xcodeproj-1.5.7
Installing ri documentation for xcodeproj-1.5.7
Parsing documentation for ruby-macho-1.1.0
Installing ri documentation for ruby-macho-1.1.0
Parsing documentation for cocoapods-1.5.0
Installing ri documentation for cocoapods-1.5.0
Done installing documentation for cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, netrc, cocoapods-trunk, molinillo, atomos, colored2, nanaimo, xcodeproj, ruby-macho, cocoapods after 9 seconds
13 gems installed
複製程式碼

報錯:

  • Operation not permitted - /usr/bin/xcodeproj

    解決辦法:sudo gem install -n /usr/local/bin cocoapods
    複製程式碼
  • While executing gem ... (TypeError) no implicit conversion of nil into String

    // 解決辦法是執行如下命令更新gem
    sudo gem update --system
    複製程式碼

6. 再次檢視下CocoaPods的版本,已經成功升級咯!

pod --version

1.5.0
複製程式碼

相關文章