The problem: gem install debugger

I recently has to setup Ruby on a new machine, and got this error running gem install debugger -v ‘1.6.2’. There is a fix, thankfully:

ERROR:  Error installing debugger:
	ERROR: Failed to build gem native extension.

        /Users/houen/.rbenv/versions/1.9.3-p484/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p484 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.

The reason: debugger-ruby_core_source gem

The important line to note here is this:

No source for ruby-1.9.3-p484 provided with debugger-ruby_core_source gem.

Even though we are installing debugger -v ‘1.6.2’, the error is in installing a requirement, debugger-ruby_core_source.

The fix: gem install debugger-ruby_core_source

It is actually quite easy to fix this error. Just run the below command, installing the dependencies, and retry:

gem install debugger-ruby_core_source