一诈悍、重裝cocoapods
1.卸載原有cocoapods
rm -fr ~/.cocoapods/
2.查詢Ruby源地址為:https://gems.ruby-china.com/
gem sources -a https://gems.ruby-china.com/
gem source -l
3.安裝homebrew (時間略久黎侈,等就完事兒)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
4.安裝rvm
curl -L get.rvm.io | bash -s stable
source ~/.bashrc
source ~/.bash_profile
5.安裝ruby
rvm install 3.0.0
6.設(shè)置成默認版本
rvm use 3.0.0 --default
7.安裝cocoapods
sudo gem install -n /usr/local/bin cocoapods
image.png
pod setup
finish
遇到 command not found: pod
直接卸載重裝
二、repo源
目前有兩種常用的repo彪薛,一個master,一個trunk疚漆,分情況使用偷卧,如果trunk不能拉取可在podfile中添加
source "https://github.com/CocoaPods/Specs.git"
使用master源拉取代碼,然后再行 pod install
image.png
問題:如果在pod update時報錯 CocoaPods was not able to update the cocoapods
repo. If this is an unexpected issue and persists you can inspect it running pod repo update --verbose
image.png
解決:
1.查看repo
pod repo
2.只保留master和trunk姆钉,把不用的repo刪除
pod repo remove cocoapods
image.png
3.再次拉取 恭喜成功
pod install
此為將trunk源更換為master拉取
image.png