Start the debugger session
RubyMine allows you to debug Ruby scripts, Rails applications, and tests. Starting a debugger session is very similar to running your code. The debugger is attached behind the scenes, so you don't have to configure anything specific to start a debugger session. The topics below describe how to run:
RubyMine allows you to debug code without previous configuring or by using the configured set 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.
Set breakpoints in the source code.
If necessary, create or modify the corresponding Run/Debug configuration.
Configure the debugger options on the Settings | Build, Execution, Deployment | Debugger page.
To debug a specified Ruby script (for example, script.rb), do one of the following:
Press twice to invoke the Run Anything popup and type the ruby script.rb command. Then, hold down the key (the dialog title will be changed to Debug) and press .
tip
To debug scratch files or scripts outside the project root, hold down the and keys before running the command (in this case, the dialog title is changed to Run in Context with Debug).
Right-click a script in the editor or project tool window, and select Debug 'script'.
Press twice to invoke the Run Anything popup. Start typing the required configuration name and select it from the list. Then, hold down the key (the dialog title will be changed to Debug) and press .
note
Note that you can also use Run Anything to debug Ruby/Rails without previous configuring.
Click the button on the toolbar to run the currently selected run/debug configuration.
Select the Run | Debug command from the main menu and select the required configuration.
Learn how to start a debugging session for tests from the Run tests topic.
When the debugger session is running, you can pause/resume it as required using the buttons on the toolbar of the Debug tool window:
To pause a debugger session, click .
To resume a debugger session, click .
Click on the toolbar of the Debug tool window. Alternatively, press and select the process to terminate (if there are two or more of them).