RubyMine 2018.3 Help

Using the Bundler

RubyMine supports integration with Bundler and enables you to handle gem dependencies for your application right inside the IDE. To use this capability, you need to install the Bundler gem to the project SDK.

Install Bundler

To install the Bundler gem to the project SDK, select Tools | Bundler | Install Bundler. You can also install the Bundler gem along with other gems from the Gemfile.

Create Gemfile

If your project does not contain the Gemfile, you can create it by choosing the Tools | Bundler | Init command. This command is available when the Gemfile doesn’t exist.

Install Gems to Local Interpreter

You can install gems defined in the Gemfile to the project interpreter in one of the following ways:

  • Click Tools | Bundler | Install. Within this menu, you can also use other Bundler commands such as Update, Clean, etc.

  • Install missing gems using the Missing gem inspection provided by the IDE. For example, open the Gemfile, place a caret to any highlighted gem missing in the project SDK and press Alt+Enter:

    rm gems gemfile install intention
  • When you open a project or change the project SDK, the following message displays:

    rm gems not installed warning

    Click Install to install missing gems. If Bundler is not installed the following message appears:

    rm gems no bundler gem found

    Click Yes.

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

rm gems bundle install dialog

You can also pass the required arguments when running this command:

rm gems bundle install dialog production

The Run tool window will display a process of installing gems:

rm gems installing output

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

rm local sdk gems page

… and the External Libraries node of the project tree:

rm gems installed external lib

Install Gems to Project

RubyMine allows you to work with gems installed not only to the SDK but to a project itself. To do this, pass the following argument when running the bundle install command: --path vendor/bundle

rm gems bundle install dialog vendor

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

Local gems will be displayed in the External Libraries node of the project tree:

rm gems installed external lib vendor

Install Gems to 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 icons vcs mapBase button in the Ruby SDK and Gems page:

rm gems sdk page remote

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

rm remote attach 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 icons actions download svg button in the Ruby SDK and gems page.

Last modified: 6 December 2018

See Also

Web Resources: