Skip to content

Fixing ‘mkmf’ load error Ruby in Ubuntu

If you’re a Debian or Ubuntu user you’ll find that the Ruby standard

distribution is split into lots of little packages so doing something like

apt-get install ruby

only gives you the ruby binary and a subset of the libraries for Ruby. You’ll

need to add more packages if you want to utilize more of Ruby’s standard

library. This is all in order to comply with

Debian packaging Guidelines.

That is all well and good but a little frustrating when you ‘just want to

do work’.

For example, I wanted to install

sys-proctable

(Something I really believe should be in Ruby’s standard distribution)

however ran into the following:

$ sudo gem install sys-proctable

Building native extensions. This could take a while…

extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)

    from extconf.rb:8

ERROR: While executing gem … (RuntimeError)

   ERROR: Failed to build gem native extension.

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sys-proctable-0.7.3 for inspection.

To get around this you will need to install ruby1.8-dev (or ruby1.6-dev or

whatever version of ruby you’re running) to get mkmf.rb which is listed

in the Ruby Standard Library.

I’m sure most Ruby hackers worth their salt consider this a ‘duh’ thing

but not of all of us can be shining stars in the Ruby community

How I fixed it…

$ sudo apt-get install ruby1.8-dev

..

$ sudo gem install sys-proctable

Need to update 4 gems from 

{ 3 } Comments

  1. Brian Rowe | December 18, 2006 at 1:05 pm | Permalink

    Thank you!! I am running Gentoo and slowly moving to Ubuntu and this was killing me. Solved the first problem trying to get ruby-ncurses to work on Ubuntu. I already have this working on Gentoo and OSX. Thanks

  2. Liam | January 14, 2007 at 5:44 am | Permalink

    Thanks! this got me past an issue that was driving me nuts….

  3. Tracy Bahm | February 7, 2007 at 10:54 am | Permalink

    Thanks! This was the trick I needed in order to successfully get the Oracle Rails library installed.

{ 5 } Trackbacks

  1. [...] search led me to one Al Hoang, who discovered that upgrading to ruby1.8-dev would resolve this — apparently mkmf.rb is not [...]

  2. [...] But of course if I had it… I would be having an issue.  I searched more and found this blog post that talked about mkmf and Ubuntu.  It said to install ruby1.8-dev.  Simple enough.  Install the [...]

  3. [...] Su p*** madre. Al menos esto fue googlear medio minuto, y al parecer es problema con mi versión de Kubuntu. Un sencillo sudo apt-get install ruby1.8-dev y solucionado. Cortesía de Al Hoang [...]

  4. [...] I got the solution thanks to this guy [...]

  5. [...] How to fix your gem / mkmf error in !ruby http://blogs.law.harvard.edu/hoanga/2006/10/27/fixing-mkmf-load-error-ruby-in-ubuntu/ [...]