RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
And that is exactly what it is. It helps you install multiple versions of Ruby and then switch between them as required. It makes this so easy, you will fall in love with it!
So, let's get things rolling. First step,
Note: This following article assumes you are running a recent version of Ubuntu. If you're following along, please do alter the commands for your distribution as required.
curl (if you don't already have it)
$ sudo apt-get update $ sudo apt-get install -y curl
Importing the keys
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
The Actual Install
$ curl -sSL https://get.rvm.io | bash -s stable
And that's it, you're done! Pretty simple, huh?
One final touch to the installation, add the following line to the end of your
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
If you are continuing on the same terminal session you used to install
source "$HOME/.rvm/scripts/rvm" , else fire up a new terminal and run the following command to install the latest version of ruby.
$ rvm install ruby --latest
This installs the required dependencies for rvm to function (which prompts for your password) as well as the latest version of ruby, which at the time of writing is
$ ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
To see what other versions of ruby you can install using rvm,
$ rvm list known
Let's install another version of ruby, just for kicks.
$ rvm install ruby-2.1.8
To see what ruby environments you have installed, we can use the
$ rvm list command.
$ rvm list rvm rubies ruby-2.1.8 [ x86_64 ] =* ruby-2.3.0 [ x86_64 ] # => - current # =* - current && default # * - default
To switch between them, we use
$ rvm use <ruby-version>
$ rvm use ruby-2.1.8 Using /home/nitin/.rvm/gems/ruby-2.1.8 $ ruby -v ruby 2.1.8p440 (2015-12-16 revision 53160) [x86_64-linux] $ rvm use ruby-2.3.0 Using /home/nitin/.rvm/gems/ruby-2.3.0 $ ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
It's that simple! Makes life a whole lot easier doesn't it?
$ rvm use ruby-2.3.0 RVM is not a function, selecting rubies with 'rvm use ...' will not work.
The fix is simple, adding the
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" to the end of your
~/.bashrc file should do it. And if you want to continue using the same terminal session, source the script manually -
source "$HOME/.rvm/scripts/rvm" as well.
# Installing rvm $ sudo apt-get update $ sudo apt-get install -y curl $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 $ curl -sSL https://get.rvm.io | bash -s stable $ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc $ source "$HOME/.rvm/scripts/rvm # Installing ruby $ rvm list known $ rvm install ruby --latest $ rvm install ruby-2.1.8 $ rvm list $ rvm use ruby-2.1.8
To learn more about
Download the official 2buntu app for both Android and Ubuntu Touch.