Celeb Glow
updates | April 04, 2026

Ruby command not recognized after installing it with rvm

I followed this tutorial to install ruby with rvm:

The problem is that everytime that I log in, the ruby installation is not recognized, for example if I try executing a ruby script with the "ruby" command this is what I get:

enter image description here

To make it be recognized I have to run this command:

source ~/.rvm/scripts/rvm

But every time I login I have to do it again.

1

3 Answers

What went wrong?

During installation, rvm puts two lines (first one is a comment though) in ~/.bash_profile file to help bash recognize ruby binaries. But the problem is Ubuntu's bash ignores this file. As a result, it doesn't know that you already installed ruby and prompts you to install ruby!

The problem can be solved in two different way.


Solution 1: Using ~/.bashrc file

Open your ~/.bashrc file and put these two lines (or last one) there.

### Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Solution 2: Make the regular shell session as login shell

Or you can turn on your virtual terminal's preference to consider the shell as Login Shell. The settings can be found in -

  • Gnome Terminal: Menu > Edit > Profile Preference > Command Tab > Run command as a login shell

  • Mate Terminal: Menu > Edit > Profile Preference > Title & Command Tab > Run command as a login shell

  • Xfce4 Terminal: Menu > Edit > Preference > General Tab > Run command as login shell

Either one will do the job.


Another solution could be installing Ruby in System using Ubuntu's repository. But that defeats the purpose of using rvm at first place.

2

You can install Ruby by typing:

sudo apt-get install ruby-full

See the Doc.

This will install old version of ruby (1.9) currently existing in Ubuntu repos. You might want to check installation from source

Download ruby tar from here and then run:

$ tar -xf ruby-your-downloaded-package
$ cd ruby_extracted_directory
$ ./configure
$ make
$ sudo make install

In some cases you will need to realod bash by typing:

$ bash

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy