1.安装 hombrew:
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
hombrew
安装完成后,继续执行命令行设置全局变量(实际就是将以下信息写入/Users/xxx/.zprofile
或者/Users/xxx/.zshrc
)
eval "$(/opt/homebrew/bin/brew shellenv)"
2.安装ruby
brew install ruby
设置全局变量
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
全局变量立即生效
source xxxx.zprofile
3.安装cocoapods
sudo gem install -n /usr/local/bin cocoapods
sudo gem install cocoapods
(废弃 不知道装哪去了 会报错 pod not found...)
如果报错要升级ruby
brew upgrade ruby
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/