This is an updated re-post of Using ruby-debug on Ruby 1.9.3 preview1 updated for Ruby 1.9.3 p0 (release, patch level 0).
Ruby 1.9.3 has a slightly broken build process. In the final step of compilation it hides a number of symbols while linking the ruby binary. This means ruby-debug's extension can't get all the information it needs to make the debugger work and it breaks.
To fix, first grab some coffee, tenderlove-style.
$ git apply <( curl [https://github.com/ruby/ruby/pull/56.diff](https://github.com/ruby/ruby/pull/56.diff) )
Recompile, making sure you run autoconf (I don't think RVM does by default):
$ autoconf -f && ./configure --prefix="$HOME/.rbenv/versions/1.9.3-p0" && make -j3
Double check it's worked by checking the
_ruby_current_thread symbol is visible (or you can just trust me):
$ nm ruby | grep current_thread 00000001002249d0 D _ruby_current_thread
Then install as normal (
make install), set up rubygems,
gem install ruby-debug19 and try it out:
$ ruby -v -r rubygems -r ruby-debug -e 'Debugger.start and puts Debugger.current_context' ruby 1.9.3p0 (2011-10-30 revision 33569) [x86_64-darwin11.2.0] #<Debugger::Context:0x007fea0b8957e0>
Hooray! The future is now; you can get back to debugging your Rails 3.1 apps with ruby-debug on Ruby 1.9.3.
This probably isn't the canonical solution—I'm no autotools or C expert—but it works for now. I'm sure they'll fix it properly for the next release.