How to Install Ruby-Debug in Ruby 1.9.3/Rails 3.2.1

how do I install ruby-debug in ruby 1.9.3 / Rails 3.2.1

Thanks to @Marc Talbot's comment in the OP, I found a working recipe.

download linecache19 and ruby-debug-base19 from RubyForge:

% curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
% curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem

compile the two gems

% 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=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions. This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
...

update your Gemfile

# file: Gemfile
...
group :development do
gem 'linecache19', '0.5.13'
gem 'ruby-debug-base19', '0.11.26'
gem 'ruby-debug19', :require => 'ruby-debug'
end

bundle install and test the debugger

% bundle install
Fetching source index for http://rubygems.org/
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
% irb
irb(main):001:0> require 'ruby-debug'
=> true
irb(main):002:0> debugger
$SANDBOX/usr/lib/ruby/1.9.1/irb/context.rb:166
@last_value = value
(rdb:1) p 'hooray'
"hooray"

Hopefully this will help others.

Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with Symbol not found: _ruby_threadptr_data_type

A fork of ruby-debug just called 'debugger' now exists that incorporates many of the fixes people had been deploying on top of ruby-debug19, so you should be able to just change your Gemfile to

gem 'debugger'

... and off you go.

Debugging in ruby 1.9

Note: this answer was correct but is now out of date. See the below correct answer. TL;DR: use 'debugger' now.

ruby-debug is now available with Ruby 1.9.x. See http://www.github.com/mark-moseley

To install (using gem on 1.9 Ruby installation):

gem install ruby-debug19

(with perhaps the necessary 'sudo' in front of it).

Can't install ruby-debug-base19x gem

1) Try download linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem from http://rubyforge.org/frs/?group_id=8883

2) gem install linecache19-0.5.13.gem

3) gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=[your ruby source]
or you can try gem install ruby-debug-base19x --pre

Can't install ruby-debug, error: rb_method_entry_t.called_id

ruby-debug is broken for ruby 1.9, give "pry" a try, instead. Maybe it is possible to get ruby-debug working but I wouldn't count on it.

Debugging in ruby 1.9

Install specific ruby version into vendor/bundle?

Bundler uses the value from RbConfig::CONFIG["ruby_version"] to build the directory for the gems (see https://github.com/bundler/bundler/blob/master/lib/bundler/installer/standalone.rb#L38).

This "ruby_version" does not care for teeny_version value and only ever outputs the Major.Minor versions.

That leads to

2.2.x -> 2.2.0

2.3.x -> 2.3.0

2.4.x -> 2.4.0

and so on.

I do not now why the teeny_version does get ignored. I do know, that you could use --with-ruby-version=2.4.1 do set the value yourself.



Related Topics



Leave a reply



Submit