How to configure debugger with Ruby 1.9.3-p125


I'm trying to use debugger with rspec with following version of software:
  rails 3.2.1
  rvm (stable 1.10.2)
  ruby 1.9.3-p125
  MacOS X 10.7.3, Xcode 4.3

Now, I figured out a configuration to run "rails console --debugger" with information I've gotten from:
  (I used answer refer to this gist: )

I set a break point, and run rspec.
Unfortunately, with this configuration, rspec stop with error.

/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) "/Applications/RubyMine"
Testing started at 15:06 ...
/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-ide-0.4.17.beta8/bin/rdebug-ide --port 61575 -- /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/bin/rspec --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter
<< source paths here >>
Fast Debugger (ruby-debug-ide 0.4.17.beta8, ruby-debug-base 0.11.30.pre10) listens on
Work directory: /Users/shigeya/work/aimm3/}
Searching files....
<< rspec sources here..>>
47 files were found.
RSpec script : /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/bin/rspec
Spec Options:
Running specs...
Command line:
["/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125/bin/ruby", "-e", "at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)", "/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-ide-0.4.17.beta8/bin/rdebug-ide", "--port", "61575", "--", "/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/bin/rspec", "--require", "teamcity/spec/runner/formatter/teamcity/formatter", "--format", "Spec::Runner::Formatter::TeamcityFormatter",
<< SPEC PATHS >> ]
dyld: lazy symbol binding failed: Symbol not found: _rb_vm_get_sourceline
  Referenced from: /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-base19x-0.11.30.pre10/lib/ruby_debug.bundle
  Expected in: flat namespace
dyld: Symbol not found: _rb_vm_get_sourceline
  Referenced from: /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-base19x-0.11.30.pre10/lib/ruby_debug.bundle
  Expected in: flat namespace
/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake- `block in create_shell_runner': Command failed with status (): [/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125...] (RuntimeError)
     from /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake- `call'
     from /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake- `sh'
     from /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake- `sh'
     from /Applications/RubyMine `<top (required)>'
     from -e:1:in `load'
     from -e:1:in `<main>'
Process finished with exit code 1

How I can make Rubymine happy?

Current Gemfile is here:


Forgot to mention. I'm using Rubymine 4.0.1


It looks like your problem is caused by XCode 4.3. Please see rvm requirements output:

Xcode 4.2:
* is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
* it breaks gems with native extensions, especially DB drivers.


I haven't realized that. Will try to find workaround.

thank you.


For me even XCode 4.2 worked ok, but 4.3 doesn't :(


rvm requirements mentioned about osx-gcc-installer, so I tried it but no luck buidling Ruby 1.9.3-p125
(fails during building ruby itself.)

Installing Xcode 4.2.1 and trying..
at least, clang for Xcode 4.2.1 don't build Ruby 1.9.3-p125.
Thus, I have to set CC=gcc-4.2 before build anything..

At this moment, I don't progaram on iOS so no problem, but I need latest Xcode sometime in future.
So, I hope to have Xcode 4.3.x (or something new) to resolve this..


Looks like debug extension seems to be OK with Xcode 4.2.1.
I still have issues to be resolved but it's looks like ruby language level or configuration issue.


It's working fine with Rails development environment.

Isn't it possible to debug in RSpec run?


Here's the corresponding issue is Ruby bugtracker. You may also want to check this guide on setting up XCode 4.3 to work with 1.9.3. I won't be able to check it until tomorrow, but it looks ok.


Yes, it is possible to debug rspec, but you should remove any references to CLI debug gem from your gemfile, because IDE debugger won't stop on breakpoints otherwise


Thanks for info. that's looks like exactly what happend to me.

Since I'm away from office/home for four days, I'll try that later this week.



Two quesitons... if possible.

1. I need to change require 'XXX' to require_relative '../../XXX' -- why this happen?
2. I'm using log4r for logging, and when starting rspec, I've gotten

/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/log4r-1.1.10/lib/log4r/outputter/fileoutputter.rb:37:in `initialize': 'log' is not writable! (StandardError)
 from /Users/shigeya/Documents/work/aimm3/config/application.rb:84:in `new'

at application.rb:84:

        when "test"
          err_out ="file", :filename=>"log/xxtest.log", :formatter=>formatter, :trunc=>false)
          err_out.only_at INFO, WARN, ERROR, FATAL
          err_log ="AIMM3-XXCONSOLE")
          debug_out ="file", :filename=>"log/debug-test.log", :formatter=>formatter, :trunc=>false)
          debug_out.only_at INFO, WARN, ERROR, FATAL, DEBUG
          debug_log ="AIMM3-DEBUG")

It is just working fine other than rspec with debug enabled.

Any idea why this is happening?

The Log:

Current Gemfile:

Found the reason. I have no idea but working directory configuraiton was empty, cause log directory point to nowhere.

Now working fine. thanks!


Tried with latest Xcode with dynamic loader to Ruby fixed the issue.
# Xcode 4.3.1 (Apple clang version 3.1 (tags/Apple/clang-318.0.54) -- not gcc)

I added a patch to RVM repository, and sent pull request for that.

So, finally, I can debug on RubyMine with latest env. thank you


Would you be able to provide a little more detail on how you fixed the problem? I tried the Homebrew guide above with no luck. I have rvm 1.9.3-head selected and I tried installing ruby-debug-base19x by executing:

sudo gem install ruby-debug-base19x -- --with-ruby-include=/Users/USERNAME/.rvm/src/ruby-1.9.3-head/

but I still get:

compiling breakpoint.c
compiling ruby_debug.c
ruby_debug.c:24: error: conflicting types for ‘rb_iseq_compile_with_option’
/Users/USERNAME/.rvm/src/ruby-1.9.3-head/vm_core.h:505: error: previous declaration of ‘rb_iseq_compile_with_option’ was here
ruby_debug.c: In function ‘call_at_line_unprotected’:

Any ideas?

Please check my answer in this stackoverflow article:

WIth this setup, RubyMine will install debug related modules byitself. Working flowlessly.

My current Gemfile is like this:

I'm using RubyMine 4.0.2


Looks to be working. Thank you!


Please sign in to leave a comment.