How to fix Ruby mkmf (LoadError)

When you try to install a Ruby gem package (like Passenger a.k.a. mod_rails) in Ubuntu or Debian you might run into the following error:

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

/usr/bin/ruby1.8 extconf.rb
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
        from extconf.rb:8


Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out

A required file is missing. Fix it by running sudo apt-get install ruby1.8-dev (replace 1.8 with whatever version you're running - see ruby -v).

2010-09-08 ·

blog comments powered by Disqus