1、查询Ruby的源地址
gem source -l
2、替换国内Ruby镜像源
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
3、安装homebrew,执行下面代码时会检测Xcode,Command Line是否下载,建议提前下载好Xcode,否则会很慢。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
4、homebrew安装完后会有提示,按照提示执行命令

5、安装rvm(逐步运行命令)
curl -L get.rvm.io | bash -s stable
source ~/.bashrc
source ~/.bash_profile
6、安装ruby
rvm install 3.0.0
7、设置成默认版本
rvm use 3.0.0 --default
8、安装cocoapods
sudo gem install -n /usr/local/bin cocoapods
后面pod install遇到了一个问题,这里需要手动更新git,如果没下载下来就click here to download manually。

网友评论