How to use rvm and gemset
RVM
Show all ruby versions in your system.
~$ rvm list
Install ruby, example: “install ruby 2.1.5”.
~$ rvm install 2.1.5
How to use determinate version of ruby, example: “use ruby-2.1.5”.
~$ rvm use 2.1.5
Set default ruby versions.
~$ rvm use 2.2.2 --default
GEMSET
To list the full directory path for the current gemset:
~$ rvm gemdir
To list all named gemsets for the current ruby interpreter.
~$ rvm gemset list
Creating gemsets
Gemsets must be created before being used. To create a new gemset for the current ruby, do this:
~$ rvm gemset create teddy
You can also create multiple gemsets in a single command.
~$ rvm gemset create teddy roise
Alternatively, if you prefer the shorthand syntax offered by rvm use, employ the –create option like so:
~$ rvm use 2.1.5@teddy --create
Using Gemsets
Before you can use a gemset, you must first create it.
To use a gemset:
~$ rvm gemset use teddy
You can switch to a gemset as you start to use a ruby, by appending @gemsetname to the end of the ruby selector string:
~$ rvm use 2.1.5@teddy
Emptying Gemsets
If you empty a gemset, rvm will prompt you for confirmation. This action removes all gems installed in the gemset.
~$ rvm gemset use teddy
~$ rvm gemset empty teddy
To skip confirmation, pass the –force flag:
~$ rvm gemset use teddy
~$ rvm --force gemset empty teddy
Deleting Gemsets
When you delete a gemset, rvm will prompt you to confirm the deletion.
~$ rvm gemset use teddy
~$ rvm gemset delete teddy
To skip confirmation, pass the –force flag:
~$ rvm gemset use teddy
~$ rvm --force gemset delete teddy
happy code..!