RubyMine 2022.2 Help

External tools

You can define third-party applications as external tools and run them from RubyMine.

RubyMine allows you to pass contextual information from your project to the external tool as command-line arguments (for example, the currently selected file or the project source path), view the output produced by the tool, configure to launch the tool before a run/debug configuration, and more.

There are several types of external tools that you can add to RubyMine:

  • Local tools are applications that run locally on your computer.

  • Remote tools are applications executed on a remote server over SSH.

Add a local external tool

Many image editors create non-optimized png images. To optimize images, you can use the OptiPNG command-line tool. Let's set it up for use in RubyMine.

  1. Press Ctrl+Alt+S to open the IDE settings and select Tools | External Tools.

  2. Click the Add button and specify the following settings:

    • Name: The name of the tool that will be displayed in the RubyMine interface.

    • Group: The name of the group to which the tool belongs. You can select an existing group or type the name of a new group.

    • Description: A meaningful description of the tool.

    • Program: The path to the application executable file.

    • Arguments: The arguments passed to the executable file, as you would specify them on the command line.

    • Working directory: The path to the current working directory from which the tool is executed.

    The Create Tool dialog
  3. Click OK to add the tool and then apply the changes.

Run the added local external tool

To open the selected file in the newly added toolimage, do one of the following:

  • From the main menu, select Tools | Imaging | Optimize PNG.

  • Right-click a file in the Project tool window and select Imaging | Optimize PNG from the context menu.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), select Keymap, find the Optimize PNG action under the External Tools node, and assign a shortcut for it. Use the shortcut to run the tool.

When the tool runs, the output is displayed in the Run tool window:

Add a remote external tool

Remote SSH external tools are configured similarly to local external tools, but also define the remote server on which they are executed and require credentials for connecting to it via SSH.

This example demonstrates how to add date as a remote SSH external tool that is executed on a remote server and returns the current date and time on it.

  1. Press Ctrl+Alt+S to open the IDE settings and select Tools | Remote SSH External Tools.

  2. Click the Add button and specify the following settings:

    The Create Tool dialog

    This dialog provides the same set of settings as when you add a local external tool, but selecting the remote server is also suggested.

    This can be one of your configured SSH configurations or a Vagrant box.

    By default, RubyMine will ask you for the host, port, and relevant SSH credentials every time you run the tool on the server.

  3. Click OK to add the tool and then apply the changes.

Run the added tool on a remote server

  • From the main menu, select Tools | Remote tools | Date and time.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), select Keymap, find the Date and time action, and assign a shortcut for it. Use the shortcut to run the tool.

After you specify the host, port, and credentials, RubyMine will connect to the server via SSH and run the date command, returning the output to the Run tool window in RubyMine.

Web browsers

You can use a web browser to open any file from your project. By default, it is used to preview the output of an HTML file or run and debug web applications.

Open a file in a web browser

To open a file that is intended to be rendered by a web browser (HTML, XML, JSP, and so on), do one of the following:

  • Press Alt+F2.

  • Right-click a file and select Open in Browser.

  • From the main menu, select View | Open in Browser.

  • Use the browser popup in the top right part of the editor window. Click the browser button to open the web server file URL, or Shift+Click it to open the local file URL.

    Show in browser

The Open in Browser action is not available for other file types. However, you can still execute it using Find Action Ctrl+Shift+A.

View and configure the list of browsers

  • In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Web Browsers and Preview.

The Web Browsers page in Preferences

If a browser was installed using a standard procedure, the alias in the Path field should point to the right location. If it does not, specify the path to the corresponding executable file.

Use custom profile and settings

You can configure custom profiles for Firefox and Chrome family browsers.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Web Browsers and Preview.

  2. Select the browser in the list and click the Edit button.

    • For Firefox, specify the path to the profiles.ini file and choose the profile to use. For more information, see Firefox browser profile.

    • For Chrome, select Use custom user data directory and specify the location of the user data directory.

      You can also specify additional command-line options to use when running Chrome from RubyMine. For more information, open chrome://flags in the Chrome address bar.

You can define third-party standalone applications (code generators and analyzers, pre- and post- processors, database utilities, etc.) as external tools and then run them from RubyMine.

You can pass contextual information (like the currently selected file, or your project source path) to the external tools, view the tool output, and more.

The tools are defined on the External Tools page in the Settings dialog and appear as commands in the Tools menu and in various context menus. They can also be assigned keyboard shortcuts (see the Configuring Keyboards and Mouse Shortcuts section).

Last modified: 09 August 2022