RubyMine 2018.1 Help

Configuring Remote Interpreters via Vagrant

Besides that, make sure that the following prerequisites are met (outside of RubyMine):

  • Oracle's VirtualBox is installed on your computer.
  • Vagrant is installed on your computer, and all the necessary infrastructure is created.
  • The parent folders of the following executable files are added to the system PATH variable:
    • vagrant.bat or vagrant from your Vagrant installation. This should be done automatically by the installer.
    • VBoxManage.exe or VBoxManage from your Oracle's VirtualBox installation.
  • The required virtual boxes are created.

Configuring remote Ruby interpreter via Vagrant

To configure a remote Ruby interpreter

  1. In the Ruby SDK and Gems page of the Settings/Preferences dialog box, click gear icon next to Project Interpreter field.
  2. From the drop-down list, choose New remote....
    rm remote interpreter choose

    The dialog box Configure Remote Ruby Interpreter opens.

  3. In the left-hand pane of the dialog box, click Vagrant:
    rm configure remote interpreter vagrant

    In this case, the remote server settings are taken from the vagrant configuration file, defined in the page Vagrant.

  4. Click the browse button browseButton next to the field Vagrant instance folder, and specify the desired Vagrant instance folder.

    This results in showing the link to Vagrant host URL.

  5. The Ruby interpreter path field displays the path to the desired Ruby executable. You can accept default, or specify a different one.
  6. Click OK in the Configure Remote Ruby Interpreter dialog box.
  7. Back in the Ruby SDK and Gems page, if necessary, configure the path mappings:
    1. Click edit path mapping icon:
      rm edit path mapping
    2. In the dialog box that opens add (add) or delete (delete) path mappings as desired.

Adding a Vagrant box

In the Settings/Preferences dialog (Ctrl+Alt+S), click Vagrant page under the Tools node, and there (if necessary) click add to add a virtual box.

rm add vagrant box

In the Add Vagrant Box dialog box, specify the name of the new box, and its URL. Then click OK and take your time. The new box is added to the list of available boxes.

By default lucid32 is proposed to be installed, but it has no ruby on it, so in this case you'll need to add ruby. Here we will connect by SSH and install ruby manually.

Launching a Vagrant box

On the main menu, point to Tools | Vagrant, and click Init in project root to perform init command. From the dialog box that opens, select the particular Vagrant box you want to work with:

rm select vagrant box

After that, the init command is executed:

rm vagrant box init

The Vagrant configuration file Vagrantfile is created. Next, you have to perform the vagrant up command. To do that, point to Tools | Vagrant on the main menu, and that choose Up.

The command vagrant up is executed and shows its output in the Run tool window:

rm vagrant up

Note the .vagrant folder in the project structure:

rm vagrant

Installing Ruby

Now we can connect to the Vagrant Box via SSH and install ruby manually, for example using rvm. In this case on the main menu choose Tools | Start SSH session.... You'll be suggested to choose host from the list - and our Vagrant will be in the list:

rm vagrant list hosts

Configuring remote interpreter via Vagrant

Having added a Vagrant box and performed Vagrant-specific commands, it's time to configure a remote interpreter. This is how it's done...

To configure a remote interpreter via Vagrant, follow these steps:

  1. Open the Settings/Preferences dialog box again (settings on the main toolbar), and click the page Ruby SDK and Gems. Here you can select one of the existing interpreters, but what if none of the them meets your needs? Then click add and choose New remote...:
    rm interpreter types remote

    The dialog box Configure Remote Ruby Interpreter opens.

  2. In this dialog box, click the radio button Vagrant:
    rm configure remote interpreter vagrant

    In this case, the remote server settings are taken from the vagrant configuration file, defined in the Vagrant page.

    The Ruby interpreter path field displays the path to the desired Ruby executable. You can accept default, or specify a different one. When adding an rvm-based remote interpreter, it's important to specify the gem set in the Ruby interpreter path.

  3. In the Configure Remote Ruby Interpreter dialog box, click OK. The configured remote interpreter is added to the list so we can choose it and apply the changes.
Last modified: 1 August 2018

See Also

Reference:

Language and Framework-Specific Guidelines: