Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
how to get ruby 1.9.3-p125 and ruby-debug working on ubuntu 11.10
source ''
# your gems here.
group :development do
# from
# requires running:
# $ rvm reinstall 1.9.3 --patch debug --force-autoconf
# my platform section below may be debatable (lots of ways to skin the cat) but the crucial part
# is passing the --with-ruby-include param set to your rubies/src dir, where the
# debug patch was rebuilt, otherwise it won't work. AFAIK, there is no way to pass this
# param with the bundler gem dsl, most current instructions say to run it from cli, but
# that forces you to manually update your gemsets, which I didn't like... so you get this
# (note: Gem.avaliable?(name) is deprecated, hence the find_by_name awkwardness)
platform :ruby_19 do
def available?(gem_name)
(Gem::Specification::find_by_name(gem_name).nil?) ? false : true
rescue Exception => e
unless available?('ruby-debug19') || (RUBY_VERSION != "1.9.3")
system('gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src')
gem 'ruby-debug19'
# 1) run:
$ rvm reinstall 1.9.3 --patch debug --force-autoconf
Removing /local/rvm/src/ruby-1.9.3-p125...
Removing /local/rvm/rubies/ruby-1.9.3-p125...
Removing ruby-1.9.3-p125 aliases...
Removing ruby-1.9.3-p125 wrappers...
Removing ruby-1.9.3-p125 environments...
Removing ruby-1.9.3-p125 binaries...
Installing Ruby from source to: /local/rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /local/rvm/src/ruby-1.9.3-p125 (already extracted)
Applying patch 'debug' (located at /local/rvm/patches/ruby/1.9.3/p125/debug.diff)
Error running 'patch -F 25 -p1 -N -f <"/local/rvm/patches/ruby/1.9.3/p125/debug.diff"', please read /local/rvm/log/ruby-1.9.3-p125/patch.apply.debug.log
Applying patch 'xcode-debugopt-fix-r34840' (located at /local/rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff)
Error running 'patch -F 25 -p1 -N -f <"/local/rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff"', please read /local/rvm/log/ruby-1.9.3-p125/patch.apply.xcode-debugopt-fix-r34840.log
ruby-1.9.3-p125 - #autoreconf -f
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling
ruby-1.9.3-p125 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.21 for ruby-1.9.3-p125 ...
Installation of rubygems completed successfully.
ruby-1.9.3-p125 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p125 - #importing default gemsets (/local/rvm/gemsets/)
Install of ruby-1.9.3-p125 - #complete
# 2) ignore the errors above, it still worked ok as long as it gets to 'complete'
# 3) adapt the Gemfile above for your own projects. It will work for any ruby 1.9.
# 4) run:
$ rvm reload
RVM reloaded!
$ rvm gemset empty
Are you SURE you wish to remove the installed gems for gemset 'ruby-1.9.3-p125@myset' (/local/rvm/gems/ruby-1.9.3-p125@myset)?
(anything other than 'yes' will cancel) > yes
$ bundle install
# 5) use ruby-debug e.g.:
require 'ruby-debug'
def some_method
# 6) $ ruby my_codz.rb
[84, 87] in /tmp/my_codz.rb
84 def some_method
85 debugger
=> 86 print '.'
87 end
print '.'
# yays!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment