Jekyll: Failed to build gem native extension

When trying to install jekyll, I got the following error: mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

$ sudo gem install jekyll
Fetching: liquid-2.6.2.gem (100%)
Successfully installed liquid-2.6.2
Fetching: kramdown-1.6.0.gem (100%)
Successfully installed kramdown-1.6.0
Fetching: mercenary-0.3.5.gem (100%)
Successfully installed mercenary-0.3.5
Fetching: safe_yaml-1.0.4.gem (100%)
Successfully installed safe_yaml-1.0.4
Fetching: colorator-0.1.gem (100%)
Successfully installed colorator-0.1
Fetching: posix-spawn-0.3.10.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

It turns out that I was missing the ruby development packages:

$ sudo apt-get install ruby-dev

Once I’d installed this, Jekyll installed fine.

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply