Using Rvm on Ubuntu 12.04 to Use Rails. the Program 'Rails' Is Currently Not Installed

Using RVM on Ubuntu 12.04 to use Rails. The program 'rails' is currently not installed

You need to type source ~/.rvm/scripts/rvm before attempting to use Rails.

I believe the RVM installation suggests putting this line (or something similar) in your .bashrc.

Run the following command in Terminal:

echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bashrc

This appends the line source \$HOME/.rvm/scripts/rvm to the end of the .bashrc file.

Doing so ensures that RVM is properly loaded each time you open up a terminal.

Install Ruby on Rails using rvm on Ubuntu 12.04

Step One — Install Ruby with RVM

Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:

sudo apt-get update

Once that's done, we can start installin
g RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.

If you do not have curl on your system, you can start by installing it:

sudo apt-get install curl

To install RVM, open terminal and type in this command:

\curl -L https://get.rvm.io | bash -s stable

After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.

source ~/.rvm/scripts/rvm

In order to work, RVM has some of its own dependancies that need to be installed. To automatically install them:

rvm requirements
You may need to enter your root password to allow the installation of these dependencies.

On occasion the zlib package may be reported as missing. The RVM page describes the issue and the solution in greater detail here.

Step Two — Install Ruby

Once you are using RVM, installing Ruby is easy.

rvm install ruby

The latest ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use the version we just installed by default.

rvm use ruby --default

Step Three — Install RubyGems

The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.

rvm rubygems current

Step Four — Install Rails
Once everything is set up, it is time to install Rails. To start, open terminal and type in:

gem install rails

This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.

Ubuntu rvm setup issue

I highly recommend you to use the official website to install RVM: https://rvm.io/rvm/install


Your problem is that RVM is not loaded when you open a new terminal, this is why you have to manually add the source at each instance of the Terminal.

To solve this, run this command line: (if using login-shell)

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

Or this (if using non-login shell):

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc

This will add the path to RVM to load at each Terminal instanciation (close & re-open a terminal after you did this).


Take a look at @mpapis comments

rvm' is currently not installed. (Works on one terminal but not the other)

Trying sourcing your bash profile.

source ~/.bashrc 

Or

source ~/.bash_profile

Also: . ~/.bash_profile works.

This runs your bash profile in your current context (your current shell process) and sets the environment variables so they remain in this context. This is different from executing the .bash_profile like this: ./.bash_profile which will create a new shell, execute the commands there and thus not affect your current shell process.

Ubuntu not detecting Rails installation

As rails gem was installed and all the other paths look correct, you need to set rvm to use that ruby as your default version. It will set all the paths correctly so you can use your gems and rails command.

rvm use 1.9.3 --default

Ruby on ubuntu 12.04

You probably forgot the latest step when installing RVM. It is mentioned at the end of the install process but easily overlooked. It boils down to this:

Make sure you have the following lines at the bottom of ~/.bashrc:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
source "$HOME/.rvm/scripts/rvm"

This will load RVM right after you open a new shell. Without it, RVM is not 'activated' and when you type ruby it will use the version installed through your OS package manager and not the version installed through RVM.



Related Topics



Leave a reply



Submit