Recently I've been upgrading my RVM and Ruby versions. After upgrade I've encountered a problem connected to ruby-debugger. When starting Rails server I always ended with such a message:
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
# Edit: this solutions fixes also this problem:
cannot load such file -- zlib
Ruby-debbug doesn't work to well with Ruby 1.9, so I use following combination in my gemsets:
group :development, :test do gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache' gem 'ruby-debug-base19x', '~> 0.11.30.pre4' gem 'ruby-debug19' end
Until now, it worked really well, but after the upgrade, the "You need to install ruby-debug" message kept showing again and again (even when the gems from list above were installed). To fix this issue, you need to run following commands:
rm -rf $rvm_path/usr rvm pkg install zlib # Posted in 5 lines instead of 1 for better visibility sudo apt-get install build-essential openssl libreadline6 libreadline6-dev sudo apt-get install curl git-core zlib1g zlib1g-dev libssl-dev sudo apt-get install libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 sudo apt-get install libxml2-dev libxslt-dev autoconf libc6-dev sudo apt-get install ncurses-dev automake libtool bison subversion rvm reinstall 1.9.3-p194
After successful Ruby version reinstall, you should be able to run ruby software with debugger enabled.
# Update
Looks like, you can (as guys suggested in comments) debugger instead of ruby-debugger, however the method above fixes also problem with:
cannot load such file -- zlib
May 12, 2012 — 14:01
Not sure whether you’d still need all those extra packages, but it’s probably much easier to use the new debugger gem rather than ruby-debug-19.
May 12, 2012 — 14:01
Use the “debugger” gem instead for ruby 1.9 . “debugger” gem is being actively maintained now.
May 12, 2012 — 16:30
1 for the debugger Gem. I had to go through hoops to install ruby-debug on my Macbook Pro in ruby 1.9.3-p0. I upgraded to ruby 1.9.3-p194 recently and used the new “debugger” gem. It just works. No fiddling required.
May 13, 2012 — 02:42
Ruby 1.9 also has a built-in debugger: `require ‘debug’`