Posted about 1 month ago. Visible to the public.

Ruby: Using the pry debugger in projects with older Ruby versions

In case you want to use pry with an older version of Ruby, you can try the following configurations.

Ruby 1.8.7

Your pry version must not be greater than 0.9.10.

gem 'pry', '=0.9.10' gem 'ruby-debug' gem "ruby-debug-pry", :require => "ruby-debug/pry" gem 'pry-nav' gem 'ruby18_source_location'

Ruby 1.9.3

Your pry version must not be greater than 0.9.9.

gem 'debugger', '=1.1.4' gem 'pry-debugger', '=0.2.0' gem 'pry', '=0.9.9'

Known errors

No source for ruby-1.9.3-p551 provided with debugger-ruby_core_source gem

Installing debugger-linecache 1.1.2 with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/user/.rbenv/versions/1.9.3-p551/bin/ruby extconf.rb checking for vm_core.h... no checking for vm_core.h... no Makefile creation failed ************************************************************************** No source for ruby-1.9.3-p551 provided with debugger-ruby_core_source gem. ************************************************************************** *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/user/.rbenv/versions/1.9.3-p551/bin/ruby --with-ruby-dir --without-ruby-dir --with-ruby-include --without-ruby-include=${ruby-dir}/include --with-ruby-lib --without-ruby-lib=${ruby-dir}/lib Gem files will remain installed in /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/debugger-linecache-1.1.2 for inspection. Results logged to /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out An error occurred while installing debugger-linecache (1.1.2), and Bundler cannot continue. Make sure that `gem install debugger-linecache -v '1.1.2' --source ''` succeeds before bundling. In Gemfile: pry-debugger was resolved to 0.2.0, which depends on debugger was resolved to 1.1.4, which depends on debugger-linecache

Fix: Use debugger version 1.1.4:

gem 'debugger', '=1.1.4'

RuntimeError: can't modify frozen String

RuntimeError: can't modify frozen String /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': #stringify_keys - returns hash or session hash with keys stringified /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/pry-0.13.1/lib/pry/pry_class.rb:13:in `new' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/pry-0.13.1/lib/pry/pry_class.rb:13:in `<class:Pry>' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/pry-0.13.1/lib/pry/pry_class.rb:6:in `<top (required)>' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/pry-0.13.1/lib/pry.rb:61:in `<top (required)>' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'

Fix: Upgrade rubygems to version 2:

gem update --system 2

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Emanuel De
Last edit:
12 days ago
by Jakob Scholz
debugger, gemfile
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Emanuel De to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more