Installing the mysql Ruby gem

August 1st, 2009 Posted in System administration | No Comments »

While trying to install this gem on Ubuntu 8.04.3 (Hardy) to run a rails app (Redmine), I encountered the following error:

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

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

There are a bunch of common errors when installing the mysql gem, so Googling for the solution wasn’t instant. Luckily I found this post which showed the missing package: ruby1.8-dev.

Solution

sudo apt-get install ruby1.8-dev

and the MySQL gem installed fine.