1.安装Homebrew
/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"
安装成功
如果出现 zsh: command not found: brew
解决方法如下:
打开终端
1.1)执行执行以下命令:
echo "export PATH=$PATH:/opt/homebrew/bin" >> ~/.zprofile
1.2)执行命令:
export PATH=$PATH:/opt/homebrew/bin
1.3)最后执行:
source ~/.zprofile
2.验证你的Ruby镜像是并且仅是ruby-china,执行以下命令查看:
gem sources -l
2.1)查看结果;
-
*** CURRENT SOURCES ***
-
https://gems.ruby-china.com/
2.2) 如果不是执行以下代码
移除输入:gem sources --remove https://rubygems.org/
移除后添加源:输入:gem sources --add https://gems.ruby-china.com
查看是否添加成功:输入:gem sources -l
3.安装cocoapods
sudo gem install -n /usr/local/bin cocoapods
3.1如果遇到
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
执行一下命令
gem install cocoapods --user-install
查看cocoapods版本:
pod --version