Ruby Gemset

What is Gemset?

A Gemset is just a container you can use to keep gems separate from each other. We create separate gemset for different project which only have required gem with version for the particular project. It is a separate directory with version of various gems you are using.

Why Gemset?

The Big Idea: creating a gemset per project allows you to change gems (and gem versions) for one project without breaking all your other projects. Each project need only worry about its own gems. This is a Good Idea, and the wait time for installing large gems like Rails is usually worth it.

Create gemset: Here is simple command to create gemset.

rvm use 2.4.0
rvm gemset create todo

These command create new gemset todo for ruby version 2.4.0

Alternatively we can use following command to create gemset to specific ruby version.

rvm ruby-2.4.0 do rvm gemset create todo

List all gemset to particular ruby version.

rvm gemset list

Use gemset: To use gemset use following command.

rvm gemset use todo

Reference:

https://rvm.io/gemsets/basics

0Shares

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image