Gem Install Debugger Error

I am running Rails v4.0.2 on Mac OS 10.9.2 and I had everything smoothly. All of a sudden I'm getting an error saying gems are missing when I try rails server. I run bundle install and this is the output:

Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.9.0
Using atomic 1.1.16
Using thread_safe 0.2.0
Using tzinfo 0.3.39
Using activesupport 4.0.2
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.2
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.2
Using activemodel 4.0.2
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.2
Using encryptor 1.3.0
Using attr_encrypted 1.3.2
Using awesome_print 1.2.0
Using bcrypt 3.1.7
Using bcrypt-ruby 3.1.5
Using net-ssh 2.8.0
Using net-scp 1.1.2
Using tins 1.0.0
Using term-ansicolor 1.3.0
Using sshkit 1.3.0
Using capistrano 3.1.0
Using capistrano-bundler 1.1.2
Using capistrano-rails 1.1.1
Using climate_control 0.0.3
Using cocaine 0.5.3
Using coderay 1.1.0
Using coffee-script-source 1.7.0
Using execjs 2.0.2
Using coffee-script 2.2.0
Using thor 0.18.1
Using railties 4.0.2
Using coffee-rails 4.0.1
Using columnize 0.3.6
Using currencies 0.4.2
Using countries 0.9.3
Using debugger-linecache 1.2.0
Using debugger-ruby_core_source 1.3.2

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/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.

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=/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/ruby
/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory @ rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
    from extconf.rb:83:in `block in <main>'
    from extconf.rb:82:in `each'
    from extconf.rb:82:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/aaronpardes/.rvm/gems/ruby-2.1.2@ocx/gems/debugger-1.6.6 for inspection.
Results logged to /Users/aaronpardes/.rvm/gems/ruby-2.1.2@ocx/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.6/gem_make.out
An error occurred while installing debugger (1.6.6), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.6'` succeeds before bundling.

When I try to run gem install debugger -v '1.6.6' I get the following output:

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

    /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/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.

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=/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/ruby
/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory @ rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
    from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
    from extconf.rb:83:in `block in <main>'
    from extconf.rb:82:in `each'
    from extconf.rb:82:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/aaronpardes/.rvm/gems/ruby-2.1.2@ocx/gems/debugger-1.6.6 for inspection.
Results logged to /Users/aaronpardes/.rvm/gems/ruby-2.1.2@ocx/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.6/gem_make.out

I am very confused why this error came up all of a sudden. I have been up and running without issue for weeks. I've tried creating a new gemset with rvm and still encounter the same issue. After searching around I found recommendations to update dependencies first and then try bundle install but this did not solve the issue.

Answers


Ruby 2.1.2 isn't supported by debugger, unfortunately. Instead, use the byebug gem. See this discussion for more details.


Ruby 2.x is not supported by the debugger gem and you should use byebug instead. Once Rails 4.2.0 is released (or if you use the Rails 4.2.0rc versions) byebug will be the default debugger included in your Gemfile, but if you're on an earlier version of Rails then you'll need to make the change manually in your Gemfile.

Just replace

gem "debugger"

with

gem "byebug"

in your Gemfile and run a bundle install.

Some more background

Even the maintainer of the debugger gem makes this recommendation. The debugger gem's README on GitHub has the following note:

  • Only 1.9.2 and 1.9.3 are supported. For 2.X rubies, consider using byebug.

The maintainer has no intention of fixing this; he closed the issue debugger can't be installed on ruby 2.X unfixed, explaining that debugger never properly supported Ruby 2.X and that he now recommends byebug.

Additionally, the maintainer of debugger has not pushed a commit or even replied to a pull request since June 2014. The gem seems to be abandonware at this point.

Rails itself has adopted byebug as the official debugger for Ruby 2.X as of this pull request in April, and from Rails 4.2.0 onwards the Gemfile created when you run rails new my_new_app_name will reference byebug instead of debugger for Ruby 2.X users.

tl;dr

debugger is dead. Use byebug.


This monstrosity of a command ended up doing the trick for me:

gem install debugger-ruby_core_source && ARCHFLAGS="-I$(dirname -- "$(gem which debugger/ruby_core_source/ruby-$(ruby -v | awk '{sub(/p/, "-p", $2); print $2}')/vm_core.h)") -include vm_core.h" bundle install

My apologies.

Breaking it down:

  • First, install the Ruby headers.

    gem install debugger-ruby_core_source
    
  • Now, if that succeeds we want to run bundle install but it needs to be able to find those Ruby headers. Grepping the output of gem contents debugger-rebuy_core_source, we find that it installs a bunch of different headers for different patchlevels of Ruby:

    $ gem contents debugger-ruby_core_source | grep vm_core.h
    /Users/andrew/.gem/ruby/2.0.0/gems/debugger-ruby_core_source-1.3.2/lib/debugger/ruby_core_source/ruby-1.9.2-p290/vm_core.h
    /Users/andrew/.gem/ruby/2.0.0/gems/debugger-ruby_core_source-1.3.2/lib/debugger/ruby_core_source/ruby-1.9.2-p318/vm_core.h
    /Users/andrew/.gem/ruby/2.0.0/gems/debugger-ruby_core_source-1.3.2/lib/debugger/ruby_core_source/ruby-1.9.2-p320/vm_core.h
    ...
    
  • What’s the current patch level?

    $ ruby -v
    ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
    

    To transform that into the ruby-2.0.0-p318 format used by the debugger-ruby_core_source gem, we use awk to print only the second field of that version string, and change the p to -p:

    $ ruby -v | awk '{sub(/p/, "-p", $2); print $2}'
    2.0.0-p481
    
  • Now we run bundle install, with ARCHFLAGS set to add the directory containing the ruby headers to the include file search path, and preload vm_core.h:

    gem install debugger-ruby_core_source \
      && ARCHFLAGS="-I$(dirname -- \
        "$(gem which debugger/ruby_core_source/ruby-$(ruby -v | awk '{sub(/p/, "-p", $2); print $2}')/vm_core.h)") \
        -include vm_core.h" \
    bundle install
    

    i.e.,

    gem install debugger-ruby_core_source \
      && ARCHFLAGS="-I<path-to-dir_containing_vm_core.h> -include vm_core.h" \
        bundle install
    

For those who's using gem 'pry-debugger' just change it to gem 'pry-byebug' in your Gemfile.


Unfortunatelly no answer solved this problem. As answered before by nickh, "Ruby 2.1.2 isn't supported by debugger".

I found a japanese post that allowed me to install this gem, but i don't take any responsibility for it, since it's not an official release. Do it at your own risk:

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

Source: http://d.hatena.ne.jp/mabots/20140723/1406087504


**Step 1**
gilchristiano@rails-intro:~/workspace (master) $ rails --version
Could not find debugger-1.6.6 in any of the sources
Run `bundle install` to install missing gems.
**Step 2**
gilchristiano@rails-intro:~/workspace (master) $ debugger-1.6.6
bash: debugger-1.6.6: command not found
**Step 3**
gilchristiano@rails-intro:~/workspace (master) $ gem install debugger -v '1.6.6'
Building native extensions.  This could take a while...
Successfully installed debugger-1.6.6
1 gem installed
**Step 4**
gilchristiano@rails-intro:~/workspace (master) $ bundle install

Need Your Help

Unique list of items using LINQ

c# linq silverlight list unique

I've been using LINQ for a while now, but seem to be stuck on something with regards to Unique items, I have the folling list: