帮助!尝试在我的 Mac 上安装 Cocoapods,不断收到错误,我认为这可能与 Ruby 版本太旧有关。
然后发生了这样的事情:
% ruby -v
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin22]
% brew upgrade ruby
Warning: ruby 3.2.1 already installed
% ruby -v
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin22]
为什么说已经安装了?
答案1
看起来您可能$PATH
仍然指向旧的(可能是预安装的?)Ruby 版本。
尝试这个:
echo $PATH
# check if it includes the dir where homebrew installs its pkgs
# if it's not there, add the path to your .zshrc
export PATH=/usr/local/bin:$PATH
# close the terminal or, alternatiively
source ~/.zshrc
# check if the path is there
echo $PATH
brew upgrade ruby