Dec 16 2007

How to get past the `require’: no such file to load — mkmf (LoadError) when installing the “mysql” gem

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

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

After some of my readers tried my tutorial on “How to install ruby on rails in Ubuntu Gutsy Gibbon (7.10)” they ran into some trouble installing the “mysql” gem. I finally found the answer after some Googling at The summary is below.

“mkmf.rb” is part of the “ruby1.8-dev” package. Since I already had this package installed on my system, I was not experiencing the error. I installed a fresh copy of Ubuntu Gutsy Gibbon (7.10) in VMware and sure enough, I encountered the error when installing the “mysql” gem.

-You need to install the “ruby1.8-dev” package by typing the following in the Terminal:
sudo apt-get install ruby1.8-dev

-You should be able to go ahead and install the “mysql” gem now by typing the following in the Terminal:
sudo gem install mysql

I apologize if you were getting that error when you followed my previous tutorial. The tutorial has been updated with this information. Happy Coding!

Technorati Tags: ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.


18 Comments on this post


  1. Adam DiCarlo » Blog Archive » Installing the mysql Ruby gem wrote:

    [...] when installing the mysql gem, so Googling for the solution wasn’t instant. Luckily I found this post which showed the missing package: [...]

    August 1st, 2009 at 3:18 pm
  1. jamslug said:

    Thanks a lot, it works perfect!

    June 16th, 2008 at 7:20 am
  2. Jithesh said:

    Thanks man I was struggling with this I was searching for this ans Now my rail works fine thanks again

    July 24th, 2008 at 2:38 am
  3. hstagner said:

    I am glad that I could help.

    Thank you for reading!


    Harley Stagner

    July 24th, 2008 at 8:24 am
  4. bv said:

    Thank you Hstagner,
    Now it forks for me on my vmWare ubuntu image.

    November 28th, 2008 at 7:42 am
  5. elvy said:


    December 27th, 2008 at 1:13 pm
  6. Felippe Silvestre said:


    _/ \_

    Thanks a lot for this little but precious information!

    June 13th, 2009 at 1:00 am
  7. Chris said:

    OMFG! Thank you! I was lost without it. You really helped in my hour of need. Cheers!

    January 2nd, 2010 at 4:42 am
  8. Johan Hernandez said:

    You may sometimes found some errors compiling, install the package ‘libmysqlclient’ too(Ubuntu 10.04)
    Great info, thanks.

    March 4th, 2010 at 11:25 am
  9. boourns said:

    worked for me – thanks.

    May 31st, 2010 at 9:53 pm
  10. pramod said:

    It was very helpful link to me. I get past the error of mysql.


    July 27th, 2010 at 1:19 am
  11. Nitipong B. said:

    thanks ,

    September 12th, 2010 at 11:32 pm
  12. gray said:


    October 15th, 2010 at 4:23 am
  13. Tatsuya said:

    thanks. you saved my time.

    November 29th, 2010 at 7:27 am
  14. Bibek S said:

    Works, cheers! thanks a bunch

    November 30th, 2010 at 2:28 am
  15. manish nauityal said:

    try this

    this works for me

    require ‘rubygems’
    require ‘mysql’

    July 26th, 2011 at 6:21 am
  16. Neelesh said:


    Its works for me as welll

    August 10th, 2011 at 5:20 am
  17. Gene said:

    Thanks very much

    September 29th, 2011 at 2:24 pm


Subscribe Form

Subscribe to Blog


Recent Readers

                  Computers Blogs - Blog Top Sites