This feature is only supported in the Ultimate edition.

The following is only valid when Ruby Plugin is installed and enabled!

In this section:

Overview

As of this writing, IntelliJ IDEA only supports rbenv installed in the default location. However, there is a workaround. One can install rbenv in a different location using a command like the following:

ln -s /usr/local/var/rbenv ~/.rbenv

See issue RUBY-16035.

rbenv is intended for *NIX and macOS!

IntelliJ IDEA supports rbenv versions up to the latest.

 At startup, IntelliJ IDEA scans your ~/.rbenv folder , and automatically configures SDK's for each Ruby interpreter . The detected interpreters are shown in the Modules page of the Project Structure Dialog dialog .

IntelliJ IDEA also detects newly installed rbenv interpreters "on-the-fly". On reopening the Project Structure dialog, you will find updates in the Gems tab of the Modules page. .

As of this writing, IntelliJ IDEA only supports rbenv installed in the default location. However, there is a workaround. One can install rbenv in a different location using a command like the following:

ln -s /usr/local/var/rbenv ~/.rbenv

See issue RUBY-16035.

Prerequisites

  • rbenv is installed on your computer.
  • Ruby interpreters are installed.
  • IntelliJ IDEA supports rbenv Ruby interpreters installed in the default rbenv folder ~/.rbenv only.
  • rbenv is incompatible with rvm! Any references to rvm should be removed before using rbenv.

Support for rbenv-gemsets plugin

IntelliJ IDEA supports rbenv-gemsets plugin for *NIX and macOS.

  • The gemsets are shown as the children of rbenv SDK. When a gemset is selected, its gems are shown to the right, rbenv SDK with gemsets is selected, then all the gems of this SDK and the gemsets are shown.
  • IntelliJ IDEA provides libraries for gems from the current gemset list ( by '.rbenv-gemsets') including the default 'global' gemset
  • IntelliJ IDEA invokes all commands with the environment of the specified gemsets and selected SDK ( e.g. $ RBENV_GEMSETS="gemset1 gemset2" RBENV_VERSION="1.9.3-p125" #command)

File .rbenv-gemset

IntelliJ IDEA provides code insight for the .rbenv-gemset file:

  • Code highlighting
  • IntelliJ IDEA provides code completion for the current SDK gemsets in the .rbenv-gemsets file.
  • IntelliJ IDEA provides the ability to create a new gemset using the quick fix Create gemset <gemset name>. Just press Alt+Enter on a new name in the .rbenv-gemsets file:

    images/rm_rbenv_gemsets_intention.png

    The quick fix to create a new gemset is only available, if rbenv-gemsets plugin is installed !

etc.

Important note about remote interpreters

If you are configuring a remote interpreter using rbenv version manager, you have to specify ruby executable located under the directory versions, rather than shims.

See Also

Procedures:

Reference:

External Links: