Installed latest ruby but still showing old version
我已经在mac ventura上安装了最新的ruby版本,并收到了成功消息
成功安装ruby 3.2.2到/Users/myuser/.rubies/ruby-3.2.2
但是当在相同或新的终端上检查ruby --version时,我仍然在使用旧的ruby 2.6.10p210(2022-04-12修订版67958)[universal. arm 64 e-darwin 22]
我已经在bash_profile中导出了以下文件
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
export PATH=/usr/local/opt/ruby/bin:$PATH
有没有人能建议一下为什么最新版本没有反映在搜索ruby --version上。
在搜索“ruby --version”时,我们应该得到最新安装的ruby 3.2.2,但仍然显示2.6
2条答案
按热度按时间zu0ti5jz1#
当你试图通过自制软件安装ruby时,它会“只安装小桶”。keg-only是什么意思这意味着它只在自制软件的地窖里安装ruby,以避免覆盖系统预装的ruby。
如果你真的想这样做,你可以运行
brew info ruby
来查看如何将这个只支持小桶的ruby添加到你的PATH中并使其成为你的默认ruby的说明。但这是不推荐!建议安装ruby版本管理器,如rbenv、rvm或asdf。然后你就可以使用它来安装不同的ruby版本,并在它们和系统ruby之间无缝切换。
例如,以下是如何使用homebrew安装和使用
rbenv
:以下是rbenv的更多说明:
okxuctiv2#
正如@mechnicov在评论中建议的那样,建议修改系统ruby。你可以使用
asdf
包管理器。安装指南link