How to update Ruby with Homebrew?

2019-03-07 19:06发布

I want to know how to update to the latest stable version of Ruby with Homebrew. I am not interested in using RVM. Thanks.

5条回答
放我归山
2楼-- · 2019-03-07 19:08

I would use ruby-build with rbenv. The following lines install Ruby 2.6.1 and set it as your default Ruby version:

$ brew update
$ brew install ruby-build
$ brew install rbenv

$ rbenv install 2.6.1
$ rbenv global 2.6.1
查看更多
神经病院院长
3楼-- · 2019-03-07 19:11

brew upgrade ruby

Should pull latest version of the package and install it.

brew update updates brew itself, not packages (formulas they call it)

查看更多
我只想做你的唯一
4楼-- · 2019-03-07 19:15

open terminal

\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

查看更多
等我变得足够好
5楼-- · 2019-03-07 19:15

Adding to the selected answer (as I haven't enough rep to add comment), one way to see the list of available versions (from ref) try:

$ rbenv install -l
查看更多
干净又极端
6楼-- · 2019-03-07 19:21

To upgrade Ruby with rbenv: Per the rbenv README

  • Update first: brew upgrade rbenv ruby-build
  • See list of Ruby versions: versions available: rbenv install -l
  • Install: rbenv install <selected version>
查看更多
登录 后发表回答