Ruby-debug not working
Asked Answered
A

6

4

I can't get the server to start in debugging mode:

even though I have all of the correct gems installed, the server refuses to start.

$ gem install ruby-debug
ERROR:  Error installing ruby-debug:
       rbx-require-relative requires Ruby version ~> 1.8.7.

which doesn't work, other posts say to use ruby-debug19:

David@DAVID-PC /c/triton6 
$ gem install ruby-debug19
Successfully installed ruby-debug19-0.11.6
1 gem installed
Installing ri documentation for ruby-debug19-0.11.6...
Installing RDoc documentation for ruby-debug19-0.11.6...

David@DAVID-PC /c/triton6 
$ rails server --debug
=> Booting WEBrick
=> Rails 3.1.3 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

Any idea what to do?

Here is my Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.1.3'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'ruby-debug19'
gem 'execjs'
gem 'ruby-debug-ide'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails',   '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
# Pretty printed test output
gem 'turn', '0.8.2', :require => false
end
Austronesia answered 2/12, 2011 at 3:56 Comment(1)
A new fork of this code has been made and is now working. Use gem 'debugger' now. Here's a link to where this new version was pulled in for use on the core rails project: github.com/matschaffer/knife-solo/pull/38Mafia
C
4

Make sure you have gem "ruby-debug19", :require => 'ruby-debug' in your Gemfile, then run bundle install :)

Edit: Added the important :require => statement, which I missed before

Crosswalk answered 2/12, 2011 at 3:58 Comment(3)
I added my Gemfile and double checked that I'm executing in the correct locationAustronesia
Any idea where I can go from here? I am at a total loss.Austronesia
I think Joel's answer is the right one: gem "ruby-debug19", :require => "ruby-debug". At least, that's what my Ruby 1.9 based Rails apps say (now that I bothered to actually look at some Gemfiles...)Crosswalk
G
3

I had the same issues (and more) to get ruby debugging working in Aptana Studio 3. My setup and procedure to make it work:

  • Mac OS X Lion 10.7.2
  • Aptana Studio 3 (Build 3.0.8.201201201658)
  • Using rvm, in my project working directory I have a .rvmrc stating:

    rvm use ruby-1.9.3-p0@mygemset
    

To make ruby debugging work in Aptana Studio I now have the following setup

  • At the end of my Gemfile I have:

    gem "ruby-debug-base19x", "0.11.30.pre10"
    gem 'ruby-debug-ide'
    

Note that I'm NOT using ruby-debug-ide19 and ruby-debug19, Aptana Studio simply refused to use this gem. No matter what, it always picked ruby-debug-ide 0.4.16.

I'm also not using ruby-debug-base19, but ruby-debug-base19x.

  • To build the latest ruby-debug-base19x, be sure the specify the correct ruby context (include):

    rvm 1.9.3-p0@mygemset do gem install --pre ruby-debug-base19x -- --with-ruby-include=/Users/Freddy/.rvm/src/ruby-1.9.3-p0
    

Lose the rvm ... do when not using rvm.

  • Don't forget to do Bundle install (or bundle update) from your project working directory. In my terminal, when I type'Bundle list', for the mentioned gems the following versions are listed:

    linecache19 (0.5.13)
    ruby-debug-base19x (0.11.30.pre10)
    ruby-debug-ide (0.4.16)
    
  • Important : if you have linecache19 version 0.5.12 instead of .13, download the latest version from RubyForge: ruby-debug19: Project Filelist. I Downloaded it to my ~/Downloads folder, so building and installing this gem in my rvm context is as follows:

    rvm 1.9.3-p0@mygemset do gem install ~/Downloads/linecache19-0.5.13.gem -- --with-ruby-include=/Users/Freddy/.rvm/src/ruby-1.9.3-p0
    

If you needed to install linecache19 version 0.5.13, don't forget to run 'bundle update' again.

  • After all this the final issue I had (and its solution) when running the debugger in the ide is described here:

Aptana 3 ruby debugger - Exception in DebugThread loop: undefined method `is_binary_data?'

Put the code provided in the first answer above the 'module Debugger' statement in xml_printer.rb.

Enjoy!

-- Freddy

A note on building ruby-1.9.3-p0. This is a bit out of the scope of the question, but since building this was (also) a pain a hint here. Compiling ruby-1.9.3.-p0 gave multiple compiler errors related to openssl. The best thing to do is to install the openssl-0.9.8n package in the rvm environment:

  • When you have XCode 4.2 installed, first you need to put the following in your .rvmrc or .profile :

    export CC=/usr/bin/gcc-4.2
    

Don't for get to enabled it, e.g. $ source ~/.rvmrc

Grotius answered 13/2, 2012 at 12:4 Comment(0)
P
1

The answer's already in your Gemfile, I think.

gem 'ruby-debug19', :require => 'ruby-debug'
Pietra answered 2/12, 2011 at 4:54 Comment(1)
What does the stack trace say?Pietra
M
1

ruby-debug is broken. There is a new fork of the project that works that is now becoming widely used. It's the same code, just fixed. This new version is now the one used on the core ruby on rails project.

Here's the new gem: https://github.com/cldwalker/debugger

To use it just include it in your gem file

gem 'debugger'

Here's a link to the commit where it was pulled into rails:

https://github.com/matschaffer/knife-solo/pull/38

Mafia answered 7/5, 2012 at 13:21 Comment(2)
I have installed the cldwalker/debugger gem and included it in my gemfile. When I run Aptana 3 debug server, it still says: Unable to find 'rdebug-ide' binary script. May need to install 'ruby-debug-ide' gem, or may need to add your gem executable directory to your PATH (check location via 'gem environment').Treenware
Do you need to use 'ruby-debug-ide'? I don't use that part of the debugger personally and don't have that gem in my Gemfile. Have you tried taking it out and seeing if you can get the debugger working with out? I just have 'debugger' in my gem file and can debug through the rails server.Mafia
S
0

What made it work for me is:

sudo gem install ruby-debug19
gem install linecache19
gem install ruby-debug-base19
bundle update
rails server -u
Steeve answered 2/3, 2012 at 21:1 Comment(2)
Be careful when posting copy and paste boilerplate/verbatim answers to multiple questions, these tend to be flagged as "spammy" by the community. If you're doing this then it usually means the questions are duplicates so flag them as such instead: stackoverflow.com/questions/7802124Molotov
Thanks for the advise, just meant to be helpful, cause I really got stuck on thatSteeve
F
0

here is my soultion . I followed this post with no success. :(

I added the below gem to my Gemfile and ==>> run $bundle install ...worked

=added to Gemfile=> gem 'ruby-debug-ide', '~> 0.4.22'

Installing ruby-debug-ide 0.4.22
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.0
Using spring 1.1.3
Using sqlite3 1.3.9
Using turbolinks 2.2.2
Using uglifier 2.5.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
-SVE1411EGXB:~/Desktop/myapp$ 
Florey answered 5/7, 2014 at 2:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.