Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create .ruby-version and .ruby-gemset with rvm

People also ask

How do I create a Gemset in RVM?

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.

What is Gemset in RVM?

If you are using RVM(Ruby Version Manager) then using a gemset for each project is a good idea. A gemset is just a container you can use to keep gems separate from each other. Creating a gemset per project allows you to change gems (and gem versions) for one project without breaking all your other projects.


I recently had the same problem. rvm --help led me to:

rvm --create --ruby-version ruby-1.9.3@my-gemset  

It created both .ruby-gemset and .ruby-version.


According to the official RVM docs you can use this:

echo 1.9.3 > .ruby-version

Or you can use this:

rvm --ruby-version use 1.9.3@my_app

The second form will create both .ruby-version and .ruby-gemset.


Suppose I am creating gemset for my rails app whose name is tptapp then we can do it in following way.

rvm use 2.2.2@tptapp --create

here tptapp is name of gemset, 2.2.2 is Ruby version.


All of the above examples require you to type in your ruby version and gemset name .. which is close to the same keystrokes required to vi .ruby-gemset and vi .ruby-version. Assuming you are in a directory where you've already chosen your ruby version and you are pointing at the desired gemset.. this does the trick.

rvm --ruby-version use $(rvm-prompt)