1.安裝Xcode Command Line Tools。
xcode-select --install
一路安裝到底即可
2.安裝Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
1必備設置
替換 brew.git:
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
2替換 homebrew-core.git:
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
3.安裝rvm
上github下載rvm,https://github.com/rvm/rvm.git。
雙擊打開/bin/rvm-installer
.../Users/****計算機名***/.rvm/ is complete.
提示這個說明安裝完成。
然后配置到.bash_profile
export PATH="/Users/****計算機名***/.rvm/bin:$PATH"
終端輸入:rvm -v 查看版本
4.安裝 Ruby
brew install ruby
安裝完成后查看其 Ruby 源:
gem sources -l
如果顯示的ruby源不是ruby-china,則需要進行源替換:
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
5.ruby源正常, 安裝CocoaPods:
sudo gem install -n /usr/local/bin cocoapods
安裝成功后進行pod設置:
pod setup
執(zhí)行完畢后, 查看pod版本看安裝是否成功:
pod --version