As you probably know Ruby (MRI so brixen doesn’t get mad at me :P) 1.9.3 was released. I’ve been using 1.9.3 for a while now and as part of my RubyConf Uruguay talk I wanted to show ruby-debug. So my first attempt was:
$ gem install ruby-debug19
Fetching: linecache19-0.5.12.gem (100%)
Building native extensions. This could take a while...
Fetching: ruby-debug-base19-0.11.25.gem (100%)
Building native extensions. This could take a while...
Fetching: ruby-debug19-0.11.6.gem (100%)
Successfully installed linecache19-0.5.12
Successfully installed ruby-debug-base19-0.11.25
Successfully installed ruby-debug19-0.11.6
3 gems installed
Then require ‘ruby-debug’ and booom!!
$ irb
irb(main):001:0> require 'ruby-debug'
LoadError: dlopen(/Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_current_thread
Referenced from: /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
Expected in: flat namespace
in /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from (irb):1
from /Users/santiago/.rbenv/versions/1.9.3/bin/irb:12:in `<main>'
So after some research on the internet I found out that the author of ruby-debug had a fix for it which he considered unstable and didn’t push it to rubygems.org yet. Since I prefer an unstable ruby-debug than a non working one :P, I gave it a try …
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
and voilá.
So while we wait for an official release, you can enjoy a working ruby-debug.



To install ruby-debug on Ubuntu ruby-1.9.3 you also need to download from http://rubyforge.org/frs/?group_id=8883
linecache19-0.5.13.gem ruby_core_source-0.1.5.gem ruby-debug19-0.11.6.gem ruby-debug-base19-0.11.26.gem
Then
gem install archive-tar-minitar gem install linecache19-0.5.13.gem——with-ruby-include=/$rvm_src_path/ruby-1.9.3-p0 gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/$rvm_src_path/ruby-1.9.3-p0 gem install ruby-debug19-0.11.6.gem——with-ruby-include=/$rvm_src_path/ruby-1.9.3-p0
Thanks for this blog post. I don’t have a ~/.rbenv/source/ruby-1.9.3-p0 dir however. So, after looking around within the rbenv 1.9.3-p0 dir, this command did the trick:
$ gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/tomdeleu/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0
Thanks so much spastorino, I’ve been trying to get this working for weeks!
Thank you so much.
I little advice for RVM users:
I had to provide another include path:
gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/tvd/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/
That worked for me.
Do you manage to run the debugger inside a Rails 3 app?
I have created a gist for ubuntu, Ruby 1.9.3 and ruby-debug with rvm https://gist.github.com/1331533 That should be clearer
Tried installing but i still end up with the following error:
https://gist.github.com/dac9599762dc1c68f8ce
Any ideas?
thx!
This worked for me, but I also had to run ``` gem install ruby-debug19 ``` after downloading and installing the other two gems.
In order to get debugger working on a Rails 3.1 server with RVM Ruby 1.9.3p0 I followed Boris Barroso’s instructions here: https://gist.github.com/1331533
And then added the following to Gemfile: gem ‘ruby-debug19’, :require => ‘ruby-debug’
Hi! i’m repost you post: to my @vokvfqjt twitter
@Karl: having the same problem here
Ruby 1.9.3-p0 installed via rbenv
Thomas’s RVM advice helped me and I got it built. I’m running a MacBook Pro with Lion and just had to adjust the rvm path for /usr/local. By the way the auto-formatting kicked in on his comment. You have to pass a double-dash (two dash characters in a row) after the name of the gem (surrounded by spaces), then the config option name also starts with a double-dash.
Thanks guys! I don’t know what I’d do without ruby-debug. :D
Thanks you for this post!!!
with rvm I did
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/home/pabloroz/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/
gem install ruby-debug19-0.11.6.gem——with-ruby-include=/home/pabloroz/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/
and it worked
any way to use bundler for it? prereleases or a git repo, maybe?
For me, after literally hours of trial-and-error, this worked for me (using RVM on Mac running Lion with Xcode 4.2.1):
(Be sure to do “rvm 1.9.3” before running this also)
gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/YOURUSERNAME/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/
(If the following are two long dashes, replace the two long dashes above with hyphen hyphen space hyphen hyphen:
- -)You can shorten the—with-ruby-include to—with-ruby-dir=$rvm_path/rubies/ruby-1.9.3-p0
It should pick that up. if it doesn’t please file a bug with us. The—with-ruby-dir= should just make it all work.
I like to use
$rvm_path/src/`rvm tools strings`
for the with-ruby-dir / with-ruby-include switch. That way it works regardless which version of ruby I’m in or which gemset I’m in. As long as ‘rvm tools strings’ doesn’t change, that is. So my whole gem install line looks like this:
gem install ruby-debug19——with-ruby-include=”$rvm_path/src/`rvm tools strings`”
Oh, I’m currently using RVM 1.9.2. I don’t know when tools was introduced though.
On Mac OS X Lion 10.7.2 with Xcode 4.2.1 and RVM 1.9.2, this worked for me:
https://gist.github.com/1457544
This is basically the same thing that santiago.pastorino and others have said, but I wanted to make it available in clear, complete steps.
strangely I got a loadError in 1.9.3 version :
LoadError: cannot load such file—ruby_debug.so
Thanks Philip! that worked for me and was very clean!
Hi, I am trying to install ruby-debug-base19-0.11.26.gem on OSX Lion. I get
checking for rb_method_entry_t.called_id in method.h… no checking for rb_control_frame_t.method_id in method.h… no
I also filed a gist for it, https://gist.github.com/1646085 will appreciate any help.
Thanks a lot for the tip. I have been trying to install the debugger for almost a week now. I haven’t tested whether it works with the eclipse DLTK yet, but I’m at least happy that I was able to make a clean install at last :) Thanks again!!
Thanks Santiago, and especially Boris. Worked like a charm. Ubuntu 10.10 64bit, Ruby 1.9.3-p0, Rails 3.1.3. RVM.
See you at the world cup.
Cannot build gem install ruby-debug-base19-0.11.26.gem – I seem to be missing ‘method.h’ – from the mkmf.log:
conftest.c:3:20: fatal error: method.h: No such file or directory compilation terminated. checked program was: /* begin / 1: #include “ruby.h” 2: 3: #include 4: 5: /top*/
What do I need to install to get this and do I then need to rebuild the ruby? Thanks.
Got here via StackOverflow (http://stackoverflow.com/questions/8378277/cannot-use-ruby-debug19-with-1-9-3-p0) trying to install ruby-debug on an Ubuntu box and managed to get it working.
Great job, thanks Santiago!
For rbenv users trying to install this version of the ruby-debug-base19 gem, try this:
gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/lchan/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0
@googya: Did you ever figure out the `LoadError: cannot load such file—ruby_debug.so` problem? I’m getting that when using bundler to load all of the gems (after vendoring linecache19-0.5.13 and ruby-debug-base19-0.11.26), then running `bundle exec rib` and `require ‘ruby-debug’` in irb.
Worked great! Thanks for the tips.
Worked great! Thanks for the tips.
Worked great! Thanks for the tips.
Hi Santiago and commenters,
Thanks for the tips, to get my debug setup working in Mac OS X Lion 10.7.2, Aptana Studio 3, using rvm and ruby 1.9.3-p0 I had to take multiple steps which I summarized at Stackoverflow:
Ruby-debug not working – Stack Overflow
I hope this helps other developers tearing their hair out to get their ruby debug environment setup correctly.
Cheers,
My brother recommended I would possibly like this website. He was once entirely right. This put up actually made my day. You can not believe simply how a lot time I had spent for this information! Thanks!
Is there a way to package this up in the Gemfile? I was able to get it working once, but new developers who check out the project have to go through this same frustrating process.
What if we just created a new gem name (ruby-debug193) and pushed all these to rubygems? Not ideal, but infinitely better than the current situation