我Mac的ruby环境是2.6.2,我记得之前的cocoapods都装到1.10.x了,不知道什么原因,卸载后再安装就只能到1.5.3了,私活折腾不起来。最后查阅cocoapods官网,有个ruby3.2.2这么句提示,就把ruby环境升级了下,完了再去装cocoapods,就是1.12.1了。希望对大家有帮助。
升级ruby参考文章:
The best way to use ruby on mac is to use ruby version manager. I use rbenv. It allows you easly to switch between different ruby versions and doesn't cause conflicts.
To install it run brew install rbenv ruby-build
then echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
and finally source ~/.bash_profile
now install any ruby for example 3.0.0 by typing rbenv install 3.0.0 and set it globally rbenv global 3.0.0
edit: This may not work if you're using different shell. Check what shell is your default by running echo $SHELL
If your default shell is zsh, then instead of your second and third steps run:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc