Ruby on Rails: debugging rake tasks

Andrey Kuznetsov picture Andrey Kuznetsov · Apr 18, 2010 · Viewed 28.6k times · Source

When I write debugger it does not start:

NoMethodError: undefined method `run_init_script' for Debugger:Module
from /usr/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb:239:in `debugger'
from (irb):4

If I run rake my:task --debugger,it returns me to console immediately. How is it possible to debug rake tasks?

Answer

Andrey Kuznetsov picture Andrey Kuznetsov · Apr 18, 2010

I found the solution.

$ gem install ruby-debug
$ ruby-debug rake my:task

or on some systems

$ rdebug rake my:task