Can't get debugger to work on MacOS X Lion/Rails 3.2/Ruby 1.9.3

I’m trying to get the ruby debugger working and can’t seem to get there. Environment summary:

Mac OS X Lion
RVM
Ruby 1.9.3p125
Rails 3.2.3
Rspec 2.9.0

I’ve put the debugger statement in my controller like so:

def show
debugger
seasons = Season.where(:name=>params[:id])
puts @seasons
@season = seasons.first
puts @season
@season_entries = @season.season_entries
end

And run my spec like so:

$ bundle exec rspec -d spec/controllers/seasons_controller_spec.rb

Without the -d, my spec runs as I expect it - except the test fails for a reason I’m trying to figure out with the debugger. :slight_smile:

With the -d, I get this error:

/Users/dpassage/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:422:in `rescue in debug=’: (RuntimeError)

I’ve been having similar issues. There is apparently a fork of the project called simply ‘debugger’ as the original ruby-debug seems to have been abandoned (heresay).

Let me know if you find a solution; debugger didn’t work for me, but it is likely that my system is borked uniquely as most I know have no trouble.

try $ RUBYOPT='-r openssl' bundle exec rspec -d spec/controllers/seasons_controller_spec.rb

it looks weird but usually works :slight_smile:

Ryan Bates has a revised screen cast on Railscasts from yesterday (4.7.2012) that tackles this topic:

Episode #54: Debugging Ruby (revised)

http://railscasts.com/episodes/54-debugging-ruby-revised

It specifically tackles ‘how to debug a rails app using the “debugger” gem’.

Might be worth a look … or watch!

Nope, got the same error…

-D

Do you have a link to this fork? As one might imagine, googling for “ruby debugger” mostly comes up with ruby-debug.

-David

I managed to find it by searching for “ruby-debug19 fork debugger”; the github repository is here:

https://github.com/cldwalker/debugger

I did as directed and added the gem to my Gemfile, ran bundle install, and now I’m debugging! Thanks for the pointer, @1337807!

-David

Perfect, thanks! If only Ryan had posted this a couple days earlier, would have saved me a few hours :slight_smile:

-David

Ryan Bates has a revised screen cast on Railscasts from yesterday (4.7.2012) that tackles this topic:
Episode #54: Debugging Ruby (revised)
http://railscasts.com/episodes/54-debugging-ruby-revised

It specifically tackles 'how to debug a rails app using the "debugger" gem'.

Might be worth a look ... or watch!

Perfect, thanks! If only Ryan had posted this a couple days earlier, would have saved me a few hours :slight_smile:

-David