1、查詢(xún)Ruby的源地址
gem source -l
2、替換國(guó)內(nèi)Ruby鏡像源
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
3、安裝homebrew,執(zhí)行下面代碼時(shí)會(huì)檢測(cè)Xcode,Command Line是否下載,建議提前下載好Xcode,否則會(huì)很慢。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
4、homebrew安裝完后會(huì)有提示,按照提示執(zhí)行命令

執(zhí)行對(duì)應(yīng)的命令
5、安裝rvm
\curl -sSL https://get.rvm.io | bash -s stable
6、安裝ruby
rvm use ruby-3.2.0 --create --default
7、安裝cocoapods
sudo gem install -n /usr/local/bin cocoapods
補(bǔ)充安裝cocoapods的命令,該命令只安裝新添加的庫(kù),已更新的庫(kù)忽略
pod install --verbose --no-repo-update
后面pod install遇到了一個(gè)問(wèn)題,這里需要手動(dòng)更新git,如果沒(méi)下載下來(lái)就click here to download manually。

error