I just updated to Ruby 1.9.3p0 and Rails 3.1.1. Now when I try to launch the server, it complains that I should install ruby-debug, even though it's already installed.

% rails server --environment=development --debug
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting

In my Gemfile I have

# see: http://stackoverflow.com/questions/1083451/debugging-in-ruby-1-9
gem 'ruby-debug-base19', "0.11.24"
gem 'ruby-debug19', "0.11.6"

Is it possible to run debug with the latest version of Ruby?


Update (April 28, 2012)

Try the new debugger gem as a replacement for ruby-debug.

(credit to @ryanb)


Update (March 2, 2012)

Installation of linecache19 and ruby-debug-base19 can be easily done with:

bash < <(curl -L https://raw.github.com/gist/1333785)

(credit to @fredostarr)


Original answer

Have you looked at ruby-debug19 on ruby-1.9.3-preview1?

Here's a temporary solution: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

Excerpt from the site:

First download linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem from http://rubyforge.org/frs/?group_id=8883, then …

$ gem install linecache19-0.5.13.gem 
Building native extensions.  This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/Users/santiago/.rbenv/source/ruby-1.9.3-p0  
Building native extensions.  This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
$ irb
irb(main):001:0> require 'ruby-debug'
=> true

Installation of linecache19 and ruby-debug-base19 can be easily done with:

bash < <(curl -L https://raw.github.com/gist/1333785)

Someone else posted in a comment to try Pry, which is what I did. This is what's necessary for Rails:

# Gemfile
gem 'pry-rails'


# In your Rails Project where you want a 'debugger'

puts 'i want to insert some code between this'

binding.pry

puts 'and this'

Immediately after installing I notice my .irbrc doesn't load, so I don't get pretty console output. I also added this to my '~/.pryrc'

# setting up pry to have irb helpers like reload!
if defined?(Rails) && Rails.env
  extend Rails::ConsoleMethods
end

Pry has some nice features that I've wanted to check out, and I may yet return to ruby-debug once there's a simple way to integrate it into a Rails project for Ruby 1.9.3. I can run the curl command from the other answers, but this is something I'll have to point my teammates to for our Rails project, so it doesn't scale well IMO.