Home > Software engineering >  make ruby default to 3.1.2 on macOS
make ruby default to 3.1.2 on macOS

Time:07-24

I am working on macOS.

brew upgrade ruby
Warning: ruby 3.1.2 already installed

but doing

ruby -v 

would get me

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]

I tried

whereis ruby

and it is giving me

/usr/bin/ruby

I want version 3.1.2 to appear when doing ruby -v, but I ran out of idea on how to make my machine default to version 3.1.2 . Any suggestion?

CodePudding user response:

It might be easier if you use a ruby version manager like rbenv or rvm

brew install rbenv 
rbenv install 3.1.2
rbenv use 3.1.2

Otherwise, you can check this answer: https://stackoverflow.com/a/8731098/14473816

  • Related