Adil's Personal Blog

Using octopress! A blogging framework for hackers.

RVM Day to Day Usage

| Comments

RVM most used commands on daily basis

Installing rvm

$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Get rvm version

$ rvm -v

Check where rvm is installed

$ which rvm

If already installed and you want to upgrade to latest stable rvm version

$ rvm get stable

Load the latest stable rvm

$ rvm reload

List available rubies

$ rvm list known

List installed rubies

$ rvm list

Installing a ruby

$ rvm install ruby_name

Uninstalling a ruby (source, gemsets etc everything)

$ rvm remove ruby_name

Remove only the installation but not the source and few other things

$ rvm uninstall ruby_name

Using one of the rubies from installed one

$ rvm ruby_name
OR
$ rvm use ruby_name

Getting currently selected ruby version

$ ruby -v

Checking where currently selected ruby is installed

$ which ruby

Making a ruby version default

$ rvm --default ruby_name

Switching to default ruby

$ rvm default
OR
$ rvm use default

Switching to System ruby

$ rvm system
OR
$ rvm use system

Creating a gemset (on currently selected ruby)

$ rvm gemset create gemset_name

List gemset (for currently selected ruby)

$ rvm gemset list

Switching to a gemset (for currently selected ruby)

$ rvm gemset use gemset_name

Switching ruby and gemeset together

$ rvm use ruby_name@gemset_name

Deleting a gemset

$ rvm gemset delete gemset_name

Listing gems in selected gemset

$ ls $(rvm gemdir)/gems      

To get general notes about your rvm environment, about changing some default and installing few extra utilities to work with rvm

$ rvm notes

Creating .ruby-version file

$ rvm --ruby-version use 1.9.3

Creating both .ruby-version and .ruby-gemset file

$ rvm --ruby-version use 1.9.3@my_app

.rvmrc file help you select the ruby required for that particular project in directly. All you have to do is create a .rvmrc file and put this line and you are good to go

  rvm ruby_name@gemset_name

You can also create the .rvmrc with this command

$ rvm --rvmrc --create ruby_name@gemset_name