mabots' blog

知のレバレッジを最大化せよ (旧はてなダイアリーから移転しました。)

Ruby 2.1.2 と debugger 1.6.6 (1.6.8), pry-debugger が同時に動かない件を解決する

debugger, pry-debugger を使うと rspec の debug 等便利ですが、Ruby 2.1.2 にバージョンあげると衝突する模様。

どんな問題か

Ruby 2.1.2 環境で bundle で debugger をいれようとする、或いは、gem install debugger すると下記のようなエラーになる。

Building native extensions.  This could take a while...
ERROR:  Error installing debugger:
    ERROR: Failed to build gem native extension.

    /path/to/ruby extconf.rb
*** 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.

解決

$ git clone https://github.com/mekishizufu/debugger.git
$ git checkout ca451a9bdf
$ gem build debugger.gemspec
$ gem install debugger-1.6.6.gem

そもそも

  • ruby 2.x の debugging には byebug, pry-byebug *2 が推奨されている