SDK gemsets
RubyMine provides the capability to work with gemsets for the RVM and rbenv version managers. Note that this functionality is supported only for local interpreters.
To see gemsets available for the installed interpreters, open the Settings/Preferences dialog Ctrl+Alt+S and go to the Language & Frameworks | Ruby SDK and Gems page. On this page, the gemsets are shown as the interpreter children:
For RVM, you can select a certain gemset and install project gems to this gemset. On the other hand, the rbenv version manager provides the ability to select several gemsets for a project:
In this case, gems will be installed to the first enabled gemset. See Install gems for instructions on how to install gems.
Create RVM gemsets
Create a gemset for an existing project
To create an RVM gemset in the Settings/Preferences dialog Ctrl+Alt+S, go to the Language & Frameworks | Ruby SDK and Gems page and perform the following steps:
Click the button or right-click the required interpreter:
In the popup, select New RVM gemset:
In the dialog that opens, select the Ruby SDK, for which the gemset will be created. Then, specify the gemset name and click OK:
The Ruby SDK and Gems page will show the gemset as a child of the selected SDK:
Note that the asterisk is appended to the gemset name. This means that gemset is not created yet. To create it, click Apply or OK in the Settings/Preferences dialog.
Create a gemset on project creation
You can create an RVM gemset on project creation. To do this, perform the following steps:
Start creating a new project as described in Create and run your first Ruby project.
On the New Project page, click the Create link next to the Use gemset 'project_name' checkbox:
After the gemset has been created, make sure that the Use gemset 'project_name' checkbox is enabled.
This project will use the created gemset for its gems.
Create Rbenv gemsets
RubyMine enables you to work with rbenv gemsets using the rbenv-gemsets plugin. In this case, the .rbenv-gemsets file manages project gemsets. RubyMine synchronizes the gemsets enabled in the Ruby SDK and Gems page with the ones specified in .rbenv-gemsets. For instance, if you uncheck the gemset in Ruby SDK and Gems, the corresponding record will be removed from the .rbenv-gemsets file.
Furthermore, you can create and disable gemsets right in the editor:
Open the project’s .rbenv-gemsets file.
Type the required gemset name on a separate line.
Use the Create gemset ‘name’ quick fix to create a gemset:
This gemset will be shown as the child of the current SDK:
If you remove this gemset from the .rbenv-gemsets, click Update libraries:
The gemset will be disabled for the current SDK.