CocoaPods最新鏡像安裝方式和常用相關(guān)命令(卸載,降級)

安裝順序

1、安裝brew,安裝鏈接如若更新,請點(diǎn)擊此鏈接查看

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

2、安裝Ruby

$ brew install ruby

3、安裝CocoaPods

  1. 移除現(xiàn)有 Ruby 默認(rèn)源
$ gem sources --remove https://rubygems.org/
  1. 使用新的鏡像源(非網(wǎng)絡(luò)上的Taobao源)
 $ gem sources -a https://gems.ruby-china.com/

 $ gem sources -a http://rubygems.org
Last login: Thu Apr 18 17:40:56 on ttys003
pengshengsong-MacBookPro:~ pengchengsong$ gem sources
*** CURRENT SOURCES ***

http://rubygems.org
pengshengsong-MacBookPro:~ pengchengsong$ 
  1. 驗證是否成功
$ gem sources -l
  1. 安裝CocoaPods
$ sudo gem install cocoapods
$ pod setup
等待中

監(jiān)測下載進(jìn)度

1、跳轉(zhuǎn)指定文件夾

$ cd ~/.cocoapods   

2、監(jiān)測網(wǎng)絡(luò)下載進(jìn)度

$ du -sh *
監(jiān)測界面

ps: 再執(zhí)行安裝CocoaPods時 執(zhí)行$ pod setup需要等待大約半個多小時時間,有時等待了也會報錯,此處可以偷雞


偷雞教學(xué)

1、點(diǎn)擊此處下載文件提取密碼為52r5下載Repos文件并解壓

2、打開Terminal,輸入命令行 open ~/.cocoapods

3、將解壓文件替換文件夾Repos

4、再次打開Terminal,輸入命令行pod search afn

5、如果出現(xiàn)下圖為安裝完成

成功界面

查看CocoaPods版本

$ pod --version

卸載CocoaPods

  1. 查看CocoaPods路徑
$ which pod
  1. 查看CocoaPods位置
$ sudo rm -rf 路徑 
  1. 查看CocoaPods版本(-bash: /usr/local/bin/pod: No such file or directory即刪除成功)
$ pod --version
  1. 打印gem 下的所有包查看cocoapods版本號
$ gem list
  1. 移除程序包(如果要刪除依賴包只需要更改“cocoapods”即可)
$ sudo gem uninstall cocoapods -v 版本號
  1. 刪除repos包(大約300+M)
$ rmdir ~/.cocoapods

多版本共存與使用

  1. 安裝指定版本Cocoapods
$ sudo gem install cocoapods -v 0.35.0
  1. 使用指定版本Cocoapods
$ pod _0.35.0_ install,    pod _0.38.2_ install

1、初始化 podfile文件

pod init

image.png

2、查看CocoaPods版本號

pod --version

<internal:/usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require': cannot load such file -- claide (LoadError) from <internal:/usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:inrequire'
from /usr/local/lib/ruby/gems/3.0.0/gems/xcodeproj-1.19.0/lib/xcodeproj.rb:3:in <module:Xcodeproj>' from /usr/local/lib/ruby/gems/3.0.0/gems/xcodeproj-1.19.0/lib/xcodeproj.rb:1:in<top (required)>'
from <internal:/usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require' from <internal:/usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:inrequire'
from /usr/local/lib/ruby/gems/3.0.0/gems/cocoapods-1.10.0/lib/cocoapods.rb:2:in <top (required)>' from <internal:/usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:inrequire'
from <internal:/usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require' from /usr/local/lib/ruby/gems/3.0.0/gems/cocoapods-1.10.0/bin/pod:36:in<top (required)>'
from /usr/local/bin/pod:23:in load' from /usr/local/bin/pod:23:in<main>'

sudo gem install -n /usr/local/bin cocoapods

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容