Sitemap
Olivier Picault

Olivier Picault

Senior software engineer. Lives in Biarritz, France

Member-only story

Change ruby version on Mac OS X

1 min readNov 16, 2023

I know there is a ton of documentation but after reading them, StackOverflow posts and other shady blog posts, I decided to come up with what worked for me so if I or anyone in the future (including my future self) need it, they can refer to it.

By default Mac OS uses a version of Ruby located in /usr/bin/ruby. We need to change that so we can easily managed ruby version later.

  • Use rbenv
  • Install the wanted version rbenv install 3.0.1
  • Set the version as default:
rbenv local 3.0.1
rbenv global 3.0.1
  • Create a ~/.ruby-version file with the targeted version
echo "3.0.1" >> ~/.ruby-version
  • Add the following to your ~./zshrc file:
# Ruby
eval "$(rbenv init - zsh)"

and voilà!

~ cat ~/.ruby-version
3.0.1

~ ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]

~ which ruby
/Users/olivier/.rbenv/shims/ruby

~ rbenv local
3.0.1

~ rbenv global
3.0.1

--

--

Olivier Picault
Olivier Picault

Written by Olivier Picault

Senior software engineer. Lives in Biarritz, France