Saturday, May 17, 2014

Useful RVM commands

RVM stands for Ruby Version Manager. A handy tool to help you manage different Rails projects(on different versions of rails) that you've setup on your system. It also help you easily switch between different Ruby versions.

Below are some useful rvm commands that I use from time to time-
1. rvm list known
To list all *known* RVM installable Rubies
2. rvm current
The current version of rvm you're using
3. rvm gemset create gemset_name
To create a new gemset. It's quite useful when you're system has multiple apps installed, each using different versions of ruby/rails
4. rvm get stable
Helps you upgrade to the most stable version
5. rvm list
Lists the different installed rvm rubies
Sample Output -

rvm rubies

ruby-1.9.3-p327 [ i686 ]
ruby-1.9.3-p374 [ i686 ]
ruby-1.9.3-p392 [ i686 ]
=> ruby-2.0.0-p451 [ i686 ]
ruby-2.1.1 [ i686 ]
* ruby-2.1.2 [ i686 ]

# => - current
# =* - current && default
# * - default
6. rvm install 2.1.2
To install a particular ruby version via rvm.

7. rvm gemset use gemset_name

It uses a specific gemset specified by the gemset_name

8. rvm set default ruby

Helps you set up a default ruby version you'd like to use as soon as you open up your terminal

rvm --default use 1.9.3-p374

9. Create the ruby version that your project should default to when you change directory(cd) into it

rvm --create --ruby-version ruby-2.2.2@my_project

Here, my_project stands for the gemset you'd be using for this project.

10. rvm info

It gives you information about your ruby environments.

No comments:

Post a Comment