DEV Community

Neha Nakrani
Neha Nakrani

Posted on

Easy way to setting Ruby Version Manager (RVM) on projects

Ruby on Rails with RVM

RVM is Ruby Version Manager. It's a command-line tool that allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them.

Let’s get started with the first step. I can’t stress enough how valuable RVM is to the development of Ruby and Rails.
RVM allows you to create as many Ruby sandboxes as you need for development or projects or whatever. You can separate versions of Ruby as well as sets of gems called “GEMSETS

Gemset gives you the privilege of creating a set of gems specific to your particular rails application.

1. Steps for Creating a new Gemset:

Assuming that you are already on your project directory with on your machine in installed ruby versions that you want.

Step 1: rvm gemset create [name of gemset]
Step 2: rvm --rvmrc [ruby version here]@[name of gemset]
Note: You can check your current ruby version by running "ruby -v" from your console.
Step 3: Refresh your directory.
You can simply do this by checking out of your directory and going back to that directory again.
Step 4: RVM will ask you a simple Yes, No, View, Cancel question. Press Y for yes.
Step 5: You're done! Run bundle install.

2. Particular gemset Use:

As you may have more that one gemsets installed on your machine, you might need to use an explicit version of the gemset for your particular application. You can use specific gemset using the subsequent command:

rvm use <ruby version>@<gemset name> 
Enter fullscreen mode Exit fullscreen mode

if you may want to set one of the gemset as the default gemset. You can do this by using the subsequent command

rvm --default use <ruby version>@<gemset name> 
Enter fullscreen mode Exit fullscreen mode

In-Built Gemsets list:

When you install particular Ruby using RVM then it comes with 2 gemsets. default and global. You can list the gemsets that are available for current ruby version selected using the command:

rvm gemset list
Enter fullscreen mode Exit fullscreen mode

3. Delete a Gemset:

you may want to delete particular gemset using the subsequent command:

rvm gemset delete <gemset name> 
Enter fullscreen mode Exit fullscreen mode

Thank you for reading!🤗

Top comments (0)