How to attach the Rubymine IDE debugger to a shell process?

Wolfram Arnold picture Wolfram Arnold · Jan 16, 2012 · Viewed 7.4k times · Source

I want to use Rubymine's IDE debugger to debug a ruby process running in the command shell, as it is spawned, e.g. by "rails console".

I've gotten great mileage out of the debugger when running the web server (from within Rubymine) or test suites (also run from within Rubymine).

However, if the process isn't started by Rubymine, I'm at a loss of how to attach the debugger.

I'm using version Rubymine 3.2.4 on Ubuntu with Sun Java 1.6.0_26, Ruby REE 1.8.7, and the latest debug gems:

ruby-debug-base (0.10.4)
ruby-debug-ide (0.4.17.beta8)

Thoughts?

Answer

CrazyCoder picture CrazyCoder · Jan 16, 2012

Use Ruby Remote Debug configuration type in RubyMine. Refer to the official RubyMine documentation for details.

Basically you run the script like:

rdebug-ide --port <port number> -- script.rb

and then connect to the specified port from RubyMine debugger.