How to Fix ruby-debug-ide Installation Error on Windows

I recently ran into one of those classic Windows + Ruby headaches trying to install the ruby-debug-ide gem. If you’re here, I’m guessing you’ve seen something like this too.

I ran the following command:

C:\Users>gem install ruby-debug-ide --platform=ruby --pre
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed ruby-debug-ide-0.4.17.beta14
1 gem installed
Installing ri documentation for ruby-debug-ide-0.4.17.beta14...
Installing RDoc documentation for ruby-debug-ide-0.4.17.beta14...

It worked perfectly. I thought I was done!

But then I made the mistake of trying the same thing without the --pre flag:

C:\Users>gem install ruby-debug-ide --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug-ide:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe mkrf_conf.rb
Building native extensions.  This could take a while...

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.16 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.16/ext/gem_make.out

Ouch. That dreaded:

ERROR: Failed to build gem native extension.

At first, I thought maybe I was missing a dependency. But after a bit of digging, I figured out exactly what was going on.

Why This Error Happens

The problem isn’t with Ruby itself it’s with Windows.

The ruby-debug-ide gem needs to compile native C extensions, but Windows doesn’t come with a C/C++ compiler out of the box.

When I used the --pre flag, it installed a beta version (0.4.17.beta14) that already includes precompiled binaries, so it didn’t need to build anything.

But when I installed the older stable version (0.4.16), it tried to compile — and failed.

How I Fixed It

Make Sure DevKit / MSYS2 Is Installed Properly

If you’re using RubyInstaller (especially Ruby 2.x or 3.x), just run:

ridk instal

Select:

  • MSYS2 base system
  • MSYS2 development toolchain

This installs the necessary compilers.

Reinstall the Gem Using the Precompiled Version

gem uninstall ruby-debug-ide
gem install ruby-debug-ide --platform=ruby --pre

This forces Ruby to grab the beta version that doesn’t require compilation.

Use debase Instead (Recommended for VSCode / RubyMine Users)

gem install debase

Most modern editors prefer this gem over ruby-debug-ide, and it’s more actively maintained.

Testing If Debugging Works

I created a simple file called debug_test.rb:

require 'debug'

def greet(name)
  puts "Hello, #{name}!"
end

greet("World")

Then I ran:

ruby -rdebug debug_test.rb

If everything is working, I should see:

Debug mode enabled. Type 'help' for commands.
(rdb:1)

At this point, I can type commands like:

list
next
step
quit

Extra Practice: Try a Breakpoint

require 'debug'

def calculate(a, b)
  binding.break   # Pause execution here
  a + b
end

puts calculate(5, 10)

Run it, and when debugging stops, try inspecting variables:

p a
p b

Final Thought

At the end of the day, the goal isn’t just to install a gem it’s to keep moving forward with your project. Windows can be stubborn when it comes to native extensions, but once you understand why the error happens, the fix becomes straightforward. Use the precompiled version, avoid unnecessary compilation struggles, and focus your energy where it matters.

Related blog posts