RubyMine 2019.2 Help

Starting the Debugger Session

RubyMine allows you to run or debug entire Rails applications or specific Ruby scripts. The universal way to do this is using configured sets of startup parameters - run/debug configurations. For instance, you can specify the following parameters for the Rails run/debug configuration: a server type (such as Puma or Passenger), IP address and port, environment (development by default), and so on.

Run/debug configurations can be created in various ways, for example:

Learn more at Creating and Editing Run/Debug Configurations.

Before debugging

  1. Set the breakpoints in the source code.

  2. If necessary, create or modify the corresponding Run/Debug configuration.

Debug an application using a specific run/debug configuration

Use one of the following ways to debug a program with a specified Run/Debug configuration:

  • Press Ctrl twice to invoke the Run Anything popup. Start typing the required configuration name and select it from the list. Then, hold down the Shift key (the dialog title will be changed to Debug) and press Enter.

    Start debugging
  • Click the Debug button on the toolbar to run the currently selected run/debug configuration.

    Debug selected configuration
  • Select the Run | Debug Shift+F9 command from the main menu and select the required configuration.

Debug a Ruby script

To debug a specified ruby script (for example, script.rb), do one of the following:

  • Press Ctrl twice to invoke the Run Anything popup and type the ruby script.rb command. Then, hold down the Shift key (the dialog title will be changed to Debug) and press Enter.

  • Right-click a script in the editor or project tool window, and select Debug 'script'.

The actions above create the temporary run/debug configuration that can be changed and saved. You can also debug a Ruby script by creating a run/debug configuration manually and running this configuration as described in Run an application using a specific run/debug configuration.

Debug Rails applications

For Rails projects, RubyMine automatically creates the development and production run/debug configurations with corresponding Rails environments. For each configuration, you can specify a server type (such as Puma or Passenger), IP address and port, environment (development by default), and so on. The procedures below show how to change the Rails configuration and start debugging.

Change the Rails debug configuration

  1. Press Ctrl+Shift+A and start typing Edit Configurations. Select Edit Configurations and press Enter.

    Edit Configurations action
  2. In the invoked Run/Debug Configurations dialog, select the required configuration and specify its settings.

    Run/Debug Configurations dialog

    For example:

    • Server - Specifies a web server for running an application. You might need to install a corresponding gem to the project SDK (for example, the passenger gem for the Passenger server).

    • Environment - Allows you to select the Rails environment.

    • Run browser - Enables opening an application automatically in a default browser.

Debug the Rails application

  1. Press Ctrl twice.

  2. Start typing the required configuration name, select it from the list. Then, hold down the Shift key and press Enter.

    Start debugging
  3. (Optional) If the debase and ruby-debug-ide gems required for debugging have not been installed yet, RubyMine suggests installing them.

    Install gems for debugging
  4. Wait until RubyMine starts the Rails server. The Debug tool window shows the application output.

    Debug console output
Last modified: 5 September 2019

See Also