这意味着chruby命令没有正确安装(位于错误的位置,或者根本不在那里).您是否运行了网站告诉您在源命令之前运行的命令?
# 1. Install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2. Install chruby, ruby-install, and xz
brew install chruby ruby-install xz
# 3. Install ruby through chruby
ruby-install ruby 3.1.3
# 4. Make zsh use chruby's version of ruby instead of the system version
echo " $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc
echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc
echo "chruby ruby-3.1.3" >> ~/.zshrc # run 'chruby' to see actual version
编辑:抱歉,我错过了您说过您已经运行了这些命令
由于您似乎确实运行了这些命令,请try 以下操作:
# 1. find the chruby path. Mine, for example, is
# /usr/local/Cellar/chruby/0.3.9/share/chruby/chruby.sh
find / -name "chruby.sh" 2>/dev/null
# 2. find the auto.sh path. Mine is
/usr/local/Cellar/chruby/0.3.9/share/chruby/auto.sh
find / -name "auto.sh" 2>/dev/null
# 3. Add the source command to your zshrc file with the found paths
echo "source {{ insert_chruby_path }}" >> ~/.zshrc
echo "source {{ insert_auto.sh_path }}" >> ~/.zshrc
echo "chruby {{ insert_version_number }} >> ~/.zshrc
这种手动方法可能会对您有所帮助.祝你好运!