如何使用 Homebrew 更新 Ruby?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36485180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to update Ruby with Homebrew?
提问by Ralph David Abernathy
I want to know how to update to the latest stableversion of Ruby with Homebrew. I am notinterested in using RVM. Thanks.
我想知道如何使用 Homebrew更新到最新的稳定版 Ruby。我对使用 RVM不感兴趣。谢谢。
回答by spickermann
I would use ruby-buildwith rbenv. The following lines install Ruby 2.7.1 and set it as your default Ruby version:
我会用ruby-build同rbenv。以下几行安装 Ruby 2.7.1 并将其设置为您的默认 Ruby 版本:
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.7.1
$ rbenv global 2.7.1
回答by Gustavo Rubio
brew upgrade ruby
brew upgrade ruby
Should pull latest version of the package and install it.
应该拉取最新版本的软件包并安装它。
brew updateupdates brew itself, not packages (formulas they call it)
brew update更新 brew 本身,而不是包(他们称之为公式)
回答by ovisirius
回答by ltrainpr
To upgrade Ruby with rbenv: Per the rbenv README
使用 rbenv 升级 Ruby:根据rbenv README
- Update first:
brew upgrade rbenv ruby-build - See list of Ruby versions: versions available:
rbenv install -l - Install:
rbenv install <selected version>
- 先更新:
brew upgrade rbenv ruby-build - 查看 Ruby 版本列表:可用版本:
rbenv install -l - 安装:
rbenv install <selected version>
回答by Devesh
open terminal
打开终端
\curl -sSL https://get.rvm.io | bash -s stable
\curl -sSL https://get.rvm.io | bash -s stable
restart terminal then
然后重启终端
rvm install ruby-2.4.2
check ruby version it should be 2.4.2
检查 ruby 版本它应该是 2.4.2

