Thoughts about tech, programming, and more.

Rbenv Unable to Change Ruby Version on Mac OS

I’ve run into this issue on two different Mac machines now so I figured I would document the solution if it comes up again or if it comes up for someone else.

Basically – you can’t get your terminal to use the Ruby version that you want. You run rbenv install 3.0.2 and then attempt to set your global or local ruby version with rbenv global 3.02 or rbenv local 3.02 but when you check your ruby version ruby -v you’re still getting ruby 2.8.2 (or something like that).

It’s an issue where rbenv isn’t intercepting the command like it’s supposed to and the terminal ends up just using the default Ruby version that came on your machine.

The fix is simple. Open .zshrc in an editor:

nano ~/.zshrc

Add the following lines to the file:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Save and close.

Restart your terminal and do a ruby version check ruby -v. All should be working now.

Subscribe to Daniel Lemky

Sign up now to get access to the library of members-only issues.
Jamie Larson
Subscribe