Reputation: 747
My computer came with Ruby 1.8.7 installed by default. I installed Homebrew and then used it to install the latest version of ruby. When I run the following commands, I get differing responses:
brew upgrade ruby
Warning: ruby 2.6.5 is already installed and up-to-date
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Not only do the versions on these two disagree, but neither of them are the most recent version of Ruby (2.7). How do I make sure what version of Ruby I have installed, and use the latest version?
Note: this question isn't a duplicate of this question because brew install [email protected]
and other similar commands have no effect, and also because the main issue is with version disagreement.
Upvotes: 0
Views: 897
Reputation: 747
As recommended by @anothermh and @hd1, I used RVM instead of Homebrew:
Install RVM with
\curl -sSL https://get.rvm.io | bash -s stable
; restart your shell; install Ruby withrvm install 2.6.0
(for example).
Upvotes: 1
Reputation: 34677
My system has:
± /usr/bin/ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
± ruby --version
ruby 2.4.7p357 (2019-08-28 revision 67796) [x86_64-darwin19]
The reason for this is the order of the directories in the PATH variable. It's read left-to-right, so if you'd like to make sure homebrew's ruby takes precedence, put /usr/local/bin as the left-most member of your PATH variable. If you need further assistance, leave a comment.
Upvotes: 2