Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 223
David Avatar asked Jan 18 '23 03:01

David


2 Answers

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

like image 95
RyanWilcox Avatar answered Jan 28 '23 23:01

RyanWilcox


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

  • Install the openssl-0.9.8n package in the rvm environment (also see RVM: Ruby Version Manager - 'rvm pkg install openssl'):

    rvm pkg install openssl
    rvm reinstall 1.9.3-p0 --with-openssl-dir=$rvm_path/usr
    
like image 20
Visionscaper Avatar answered Jan 28 '23 22:01

Visionscaper