IntelliJ IDEA 2020.1 Help

Configure Ruby interpreter

IntelliJ IDEA enables you to choose the required Ruby interpreter for a current project or newly created projects. The IDE automatically detects interpreters installed on a local machine and maintained by version managers. Moreover, you can add additional local or remote interpreters (Docker, Vagrant, SSH, and so on).

The following interpreters are supported:

  • Ruby MRI (version 1.8.7 and later)

  • JRuby

  • TruffleRuby (without debugging)

  • Rubinius (without debugging)

Select Ruby interpreter

To configure Ruby SDK for the current project, follow these steps:

  1. Invoke the Project Structure dialog Ctrl+Shift+Alt+S and select Modules on the left.

  2. (Optional) If IntelliJ IDEA has multiple projects opened, select the required one to define a Ruby interpreter.

  3. Choose the required Ruby interpreter. You can also choose the gemset for the RVM and rbenv version managers.

    Ruby SDK and Gems

  4. For the selected Ruby interpreter/gemset, you can see the installed gems on the right. Learn more about Ruby gems support at Bundler.

If you use RVM or rbenv to manage local Ruby SDKs, you can quickly set the required interpreter in the following way:

  1. Press Ctrl twice.

  2. In the invoked popup, start typing rvm use or rbenv shell, select the required interpreter and press Enter.

  3. (Optional) If necessary, click the Rollback button in the popup that informs about the changed SDK.

Add local Ruby interpreter

IntelliJ IDEA automatically detects local interpreters installed using version managers. To add the required local interpreter manually, perform the following steps:

  1. In the Ruby SDK and Gems page, click the add button and select New local…:

    New local interpreter

  2. Provide a path to the Ruby executable (for example, /usr/local/bin/ruby for Ruby installed to macOS using Homebrew). IntelliJ IDEA will display the selected interpreter along with automatically detected interpreters.

  3. To remove the interpreter from the list, select it and click the remove button.

Add remote Ruby interpreter

Various remote development tools, such as Docker, Vagrant, or Windows Subsystem for Linux (WSL), allow you to use an isolated environment for developing your applications. This can be useful in multiple cases, for example, if you want to:

  • Develop in an isolated environment to avoid impacting your local machine configuration.

  • Run, debug, and test your application on the same operating system you deploy.

  • Develop Linux-deployed applications using the Windows Subsystem for Linux.

You can prepare the desired Ruby/Rails setup in a remote environment using Docker Compose, Vagrant box, or WSL. Then, you can add the remote Ruby interpreter in IntelliJ IDEA and run, debug, and test your application in an isolated environment right from the IDE.

To configure a remote Ruby interpreter, follow these steps:

  1. In the toolbar, click add, and choose New remote...:

    New remote interpreter

  2. In the Configure Remote Ruby Interpreter dialog, select the desired option (SSH, Docker Compose, and so on) and specify the required settings.

    Configure remote ruby interpreter

Last modified: 15 April 2020