Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby version not updating after install

Tags:

ruby

I successfully installed ruby version to 2.7, but ruby -v doesn't want to update. See output below:

➜  ~ ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]

Verify that Ruby 2.7 has been installed:

➜  ~ brew install [email protected]                        
Warning: [email protected] 2.7.6_1 is already installed and up-to-date.
To reinstall 2.7.6_1, run:
  brew reinstall [email protected]

What am I missing?

like image 362
user2892437 Avatar asked Jul 07 '26 19:07

user2892437


1 Answers

Type which ruby to find out where it's getting that executable from.

$ which ruby
/opt/homebrew/opt/ruby/bin/ruby

homebrew will put it in /opt/homebrew/opt/ruby/bin/ruby as shown there, but if that's not in your path then it will get the system ruby.

$ which ruby
/usr/bin/ruby

In that case you need to add the homebrew ruby bin directory to your PATH. I have this in my .bashrc:

export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.0.0/bin:$PATH"
like image 177
Dave Slutzkin Avatar answered Jul 11 '26 21:07

Dave Slutzkin