RubyMine 2020.1 Help


RubyMine supports integration with Bundler and enables you to handle gem dependencies for your application right inside the IDE.

Install Bundler

As a rule, the installed Ruby interpreter comes with Bundler installed. If not, you can install Bundler to the project SDK in one of the following ways:

  • Select Tools | Bundler | Install Bundler from the main menu.

  • Press Ctrl twice and execute the gem install bundler command in the invoked popup.

  • Open the RubyMine terminal emulator and execute the gem install bundler command.

Bundle init

After installing Bundler, you can initialize it:

  • Select Tools | Bundler | Init from the main menu. This creates the Gemfile in your project.

Install gems

You can install gems defined in the Gemfile to the project interpreter as follows:

  1. Do one of the following:

    • Press Ctrl twice. In the invoked popup, start typing bundler, select bundle install and press Enter.

    • Select Tools | Bundler | Install from the main menu.

    • Open the Gemfile, place a caret to any highlighted gem missing in the project SDK and press Alt+Enter. Select Install missing gems using 'bundler' and press Enter.

      Gemfile inspection
  2. (Optional) If the Bundler version installed in the selected interpreter does not match with the version specified in Gemfile.lock, RubyMine suggests you install it. Click Install in the invoked dialog.

  3. In the Bundle Install dialog, click Install to run the bundle install command without any arguments.

    Bundle Install dialog

    If necessary, pass the required arguments when running this command, for example:

    • --without production: install all gems except ones mentioned in the production group within the Gemfile.

    • --path vendor/bundle: install gems to the vendor/bundle project directory. In this case, Bundler adds the .bundle/config file to a project’s root. RubyMine processes this configuration file to detect that gems are installed into vendor/bundle.

  4. Wait until gems are installed. The Run tool window will display this process:

    Bundler output

    You can see the installed gems in both the Language & Frameworks | Ruby SDK and Gems Ctrl+Alt+S page...

    Ruby SDK and Gems page

    ... and the External Libraries node of the Project view Alt+1:

    External libraries

Install gems to a remote interpreter

If you are using a remote Ruby interpreter, RubyMine uses the Gemfile placed on a remote machine to install the gems. This requires configuring mappings between files of a local and remote project. To do this, click the Edit Path Mappings Edit Path Mappings button in the Ruby SDK and Gems page:

Ruby SDK and Gems page

In the Edit Project Path Mappings dialog, specify the local and remote project root paths:

Edit project path mappings

After you configured mappings, install gems using the Install Gems to Local Interpreter instruction.

Note that when you are using a remote interpreter, RubyMine downloads gems from a remote machine to a local cache to be able to use code insight features. In this case, you may encounter a situation when new gems were installed on a remote machine outside the IDE. To update a set of gems stored in a local cache, click the Synchronize gems Synchronize gems button in the Ruby SDK and Gems page.

Bundle exec

RubyMine provides the capability to run and debug Ruby and Rails applications, run tests, and deploy your code in a universal way - by using run/debug configurations. Run/debug configurations provide the default set of startup parameters that allow you to run the desired command quickly. You can execute any of these commands in the context of the bundle in the following way:

  1. Open the Run/Debug Configuration dialog in one of the following ways:

    • Select Run | Edit Configurations from the main menu.

    • With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector.

      Edit run configurations

    • Press Shift+Alt+F10, then press 0 or select the configuration from the popup and press F4.

  2. In the opened Run/Debug Configurations dialog, select the required configuration and open the Bundler tab.

  3. Enable the Run the script in the context of bundle (bundle exec) option and click OK.

Last modified: 29 May 2020