Remote Ruby Debug
This feature is only supported in the Ultimate edition.
The following is only valid when Ruby Plugin is installed and enabled!
In this section:
IntelliJ IDEA provides the possibility of remote debugging for Ruby and Rails applications, using the dedicated Ruby remote debug configuration. So doing, IntelliJ IDEA keeps mapping between the local sources, and the sources on the server side.
Several debug processes can be launched simultaneously. So doing, each remote debug process starts in a separate tab in the Debug tool window, with the name Remote debug for <script name>. You can work with each debugging session as usual.
Debugging a script or an application remotely
To debug a script or an application remotely, follow these general steps
- Start remote debug session.
The common format of the command to be run on the remote host is as follows:
rdebug-ide --host 0.0.0.0 --port <port number> --dispatcher-port <port number> -- $COMMAND$
You can see this command as a tip in the Ruby remote run/debug configuration dialog.
Note that there is a difference between a Ruby script and a Rails application. For example, the command for a Ruby script will be:
rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -/home/user/RubymineProjects/remote-debug-example/math_wiz.rb
The command for a Rails application will be:
rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 – bin/rails s -b 0.0.0.0
In both cases port is the port number on the remote host. dispatcher-port is the port number on the local host.
- Create local copy of the script or application to be debugged, and then set the required breakpoints.
- Create or edit Ruby remote debug configuration. For example,
- In IntelliJ IDEA, select the desired Ruby remote debug configuration, open Ruby script or Rails application in the editor, and click on the main toolbar.
See the detailed instructions in the tutorial.