命令
按照这些命令进行安装,出现问题再按照提示进行调整
1、xcode-select --install
2、brew install ruby@2.7 ruby 的安装不用 brew install ruby,安装后将 ruby2.7 更新到 .zshrc 环境变量中(terminal 会有提示)
3、sudo xcrun gem install cocoapods
4、pod setup
遇到的问题
cocoapods安装时报“Failed to build gem native extension” \
通过 sudo xcrun gem install cocoapods 安装 cocoapods
pod --version 查看版本提示警告 NoMethodError - undefined method ... /ruby/3.1.0 ... Did you mean? activated?...\
通过 brew install ruby@2.7 安装 ruby
pod install can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)\
通过 brew reinstall cocoapods 重装 cocoapods 通过 brew link --overwrite cocoapods 解决引用冲突