`require': no such file to load -- mkmf (LoadError)


I was trying to install rails on Ubuntu Natty Narwhal 11.04, using ruby1.9.1.

I installed ruby using apt-get install ruby1.9.1-full which contains the dev package. I googled the error and all have suggested I install the 1.9.1-dev which I already have.

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.
    /usr/bin/ruby1.8 extconf.rb

extconf.rb:36:in `require’: no such file to load – mkmf (LoadError) from extconf.rb:36

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out


After some search for a solution it turns out the -dev package is needed, not just ruby1.8. So if you have ruby1.9.1 doing

sudo apt-get install ruby1.9.1-dev

or to install generic ruby version, use (as per @lamplightdev comment):

sudo apt-get install ruby-dev

should fix it.

Try locate mkmf to see if the file is actually there.

.bashrc at ssh login

Adding a new entry to the PATH variable in ZSH