Because Homebrew's Ruby cannot overwrite the system's Ruby, and you might need to update macOS native Ruby for some gems.
- Homebrew, because it can manage updates on Ruby dependencies super easily. Keep in mind that you can do without it, but that's how I did it.
Before updating, save somewhere your installed gems, because something could go wrong, or a compatibility issue could occur, deleting all your gems. You can do it by simply running:
gem query --localYou can pipe the output into a file for example, with the > operand (Google it if you don't know how to use shell).
Then, install these packages with Homebrew:
brew install libyaml opensslFinally, the update command:
rvm upgrade ruby <version> --with-libyaml-dir=$(brew --prefix libyaml) --with-openssl-dir=$(brew --prefix openssl)<version> is obviously the version of Ruby you want to install. Check Ruby's site to pick a version. I personally chose 2.7.2.
In case of problems, you can rvm remove ruby and run the same command as above starting with rvm install instead of upgrade.
You can check your new version by running:
ruby -vThat's it!
You might need to downgrade rvm if the command above doesn't work. To do so, run:
rvm get 1.27.0This version of rvm is pretty stable AFAIK. However, it doesn't support latest versions of Ruby (3.0.0). Run again the command above after the downgrade.