1.执行命令
sudo gem install cocoapods
报错:You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory
非常不推荐 sudo 安装!!!
2.安装新的homebrew(参考 官网 https://github.com/homebrew/install#uninstall-homebrew)
首先卸载:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
然后安装新的
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
注意科学上网
或者配置 hosts 185.199.108.133 raw.githubusercontent.com
3.使用ruby 版本管理安装 新的ruby
参考:The fastest and easiest way to install Ruby on a Mac in 2023
brew install chruby ruby-install
ruby-install ruby 3.2.2
4.配置环境
echo "source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc
echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc
echo "chruby ruby-3.2.2" >> ~/.zshrc
5.验证文章来源:https://www.toymoban.com/news/detail-507295.html
source ~/.zshrc
ruby -v
6.不需要 sudo 文章来源地址https://www.toymoban.com/news/detail-507295.html
gem install cocoapods
到了这里,关于Mac m2 Ventura(13.4)安装Cocoapods的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!