Building native extensions for Ruby Gems on Windows

This tripped me up for a little while, so I thought I’d post it in the hope that it will save someone else some head-scratching.

If you’re running Ruby on Windows and trying to install a gem that uses native extensions, you may get an error like this (depending on how you got Ruby on to your machine):

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

c:/Ruby191/bin/ruby.exe extconf.rb
creating Makefile

make
'make' is not recognized as an internal or external command,
operable program or batch file.

Turns out the answer is quite simple: RubyInstaller DevKit.

The site has the full instructions, but to give you a quick summary it is just a matter of downloading DevKit, extracting it somewhere, then running ruby dk.rb init followed by ruby dk.rb install. I was very impressed with how easy it was to get working.

Hope this helps.

Comments