Ruby -v not working during ruby installation

Hello, I am on the Installing Ruby lesson and made it all the way to section 2.2 without any problems until now. I was supposed to put in these commands one by one:

rbenv install 2.6.5 --verbose

then,
rbenv global 2.6.5

and lastly,
ruby -v

For rbenv global 2.6.5, I typed it in and got nothing in return so proceeded to type in ruby -v. This is the code that was supposed to show after entering ruby -v:
ruby 2.6.5pxx (20xx-xx-xx revision xxxxx) [x86_64-linux]

but instead I got
Command ‘ruby’ not found, but can be installed with:

sudo snap install ruby # version 2.6.5, or
sudo apt install ruby

See ‘snap info ruby’ for additional versions.

What am I doing wrong? Is this still okay or should I try to fix this before moving on? I have looked on the discord channel and through the forum to see if anyone else has had this problem and the closest I saw was someone who didn’t have the right version of ruby which didn’t apply to my problem. I tried logging off and back on and repeating the steps and reinstalling ruby and it’s still not working. It says that it is installed but I just can’t seem to get back the command the lesson says I’m supposed to get. Please help!

Problem solved! I redid all sections of the Installing Ruby lesson again starting at the beginning and it fixed itself.

If you had this same problem as I and are reading this- DO NOT DO WHAT THE SUDO PROMPT SAYS. This one right here that might pop up if you had the same problem as I did:

sudo snap install ruby # version 2.6.5, or
sudo apt install ruby

See ‘snap info ruby’ for additional versions.

I got this in return when I did it:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

and it screwed me up in the next lesson for Ruby on rails. Skip the hassle and make sure you do it right (without sudo; as the lesson emphasizes in the beginning anyways) and just redo the all of the steps over again. If it still does not work, don’t use sudo and take the time to find help because using sudo will only mess you up during future lessons.

4 Likes

This helped me out as well! Thank you

Redoing the process fixed it for me, thanks!