David
David

Reputation: 263

Ruby-debug not working

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

Upvotes: 4

Views: 11105

Answers (6)

z atef
z atef

Reputation: 7679

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$ 

Upvotes: 0

Kevin Bedell
Kevin Bedell

Reputation: 13404

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

Upvotes: 1

standup75
standup75

Reputation: 4814

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

Upvotes: 0

Visionscaper
Visionscaper

Reputation: 4119

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

Upvotes: 3

RyanWilcox
RyanWilcox

Reputation: 13972

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

Upvotes: 4

user1976
user1976

Reputation:

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

gem 'ruby-debug19', :require => 'ruby-debug'

Upvotes: 1

Related Questions