Rbenv setup in Jekyll Docs does not match my results

When I set out to learn Jekyll, one of the more frustrating things was setting up a dev environment to work with Jekyll locally. I’m not even a Ruby beginner, so the terminology means very little to me.

I took it upon myself to document all the steps it takes to set up a Jekyll development environment and so far things are going well. However, I am now at the point where I share the steps to configure rbenv and there are some problems.

Here’s the TLDR video where I point out the issues at 3:44 (this is an unlisted video):

According to the official Jekyll Docs, I follow these steps:

rbenv install 3.0.0
rbenv global 3.0.0
ruby -v

And I should get this result:

ruby 3.0.0p0 (2020-12-25 revision 95aff21468)

Granted, in my video, I install 3.0.1, but the same problem exists. That problem is the global rbenv environment never changes from the macOS default install of Ruby, which in my case is 2.6.3.

I can use the steps provided by rbenv init To get 3.0.1 installed, but it only remains the current version of Ruby in that one terminal window.

How can you use rbenv to set a default Ruby version so it can be used universally (until or unless you want to change it again)?

Thanks!

In the video, it looked like you didn’t add eval "$(rbenv init -)" to your .zshrc file. That’s the code that sets up paths for Ruby binary and gems. Zsh loads ~/.zshrc every time a shell starts (i.e. every time a Terminal window opens), so without the change you only get the default system paths, with the system Ruby.

# Load rbenv automatically by appending
# the following to ~/.zshrc:

eval "$(rbenv init -)"