If you’re stuck trying to run Ruby on Windows, one barrier you might have encountered is in trying to install a gem like ruby-debug or rdiscount. You’ll have seen an error like this:
%gem install ruby-debug
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
'make' is not recognized as an internal or external command, operable program or batch file.
Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/linecache-0.43 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/linecache-0.43/ext/gem_make.out
That’s no fun.
The good news is, the lovely guys at Ruby Installer have put together a fix, called the DevKit. This installs the low-level bits and pieces needed to build those pesky native extensions on your Windows machine. There are a couple of manual steps which I didn’t find especially clear, so I’m documenting them here.
- Download the DevKit self-extracting archive here
- Run the archive, and when prompted, choose to extract it to C:\DevKit
- When the archive has finished unpacking, open a command prompt in C:\DevKit and run
ruby dk.rb init
ruby dk.rb install
- That’s it. You can test it using:
gem install ruby-debug