安装需要用到Ruby,虽然Mac自带了Ruby,默认源是国外的,国内源镜像是https://gems.ruby-china.com/
所以更新为国内源:
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
更新版本:
$ gem update --system $ gem -v 2.7.7
安装cocoapods:
sudo gem install cocoapods
我安装的时候出现问题:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
网上查一下,解决的办法是:
sudo gem install -n /usr/local/bin cocoapods