rubymacoshomebrewrvmrbenv

Upgrading Global Ruby Version on macOS


I am trying to update Ruby on my computer to version 2.7.0 as that is the latest stable version.

Running macOS Catalina Version 10.15.3

Have tried the top two solutions from this StackOverflow post.

1. Using just brew

brew upgrade ruby

just confirms that "ruby 2.6.5 already installed"

2. Using rbenv

rbenv install 2.7.0

rbenv global 2.7.0

After installation I get confirmation that ruby 2.7.0 is installed, but when I close terminal, and check version, 2.6.5 is still the current version.

Initially when I tried this, I got an error BUILD FAILED (OS X 10.15.3 using ruby-build 20200115). Based on advise in this github issue I found that Xcode was not installed (it was installed, but something removed it in the last few months). I re-installed it, but still got the same issue.

3. Also tried RVM based on answer 3 from this post.

rvm upgrade 2.7.0

But I am prompted if I want to use ruby-2.6.3 I did said yes by accident. So now I am back down to 2.6.3

Do I need to do something more to change the global environment settings for Ruby? It seemed that rbenv global 2.7.0 would do this.


Solution

  • As per advice from anothermh, uninstalled rbenv and brew versions of Ruby

    Uninstallation

    brew uninstall ruby for removing brew version

    Use accepted answer on this SO article for removing rbenv

    Install Ruby via RVM

    Install RVM as per instructions || as per this

    rvm install (ruby version)

    rvm --default use (ruby version)

    can use rvm list to see available ruby versions.