Solved! Installing sqlite3-ruby gem – extconf.rb mkmf LoadError

ruby on rails

Are you attempting to install the sqlite3-ruby gem and you are receiving this error?


Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

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

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

Well, we have the solution for you. Your Linux installation requires that the development libraries for SQLite3 to be installed in order to build the gem. Here is the proper way for install this gem:

How to install sqlite3-ruby gem

sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
sudo gem install sqlite3-ruby

If you are still having trouble….

Try installing the development package of Ruby 1.8 by using the command below, and then attempt to install Sqlite3:
sudo apt-get install ruby1.8-dev

See also  How to SSH to a server using Ruby - Part I

11 thoughts on “Solved! Installing sqlite3-ruby gem – extconf.rb mkmf LoadError”

  1. After running the commands you suggest, I am still getting the same error when I try to install the Ruby gem. Any ideas what else I could be missing?

  2. Great, after installing ruby1.8-dev, everything installed just as expected! Btw, when installing sqlite3-ruby, i got this sweet little message:

    Hello! The sqlite3-ruby gem has changed it’s name to just sqlite3. Rather than
    installing `sqlite3-ruby`, you should install `sqlite3`. Please update your
    dependencies accordingly.

    Thanks from the Ruby sqlite3 team!

    <3 <3 <3 <3

    maybe you should update your howto, too 😛

    Thanks again, suteno

  3. ahah! I run Linux Mint 11 and the command:

    sudo apt-get install libsqlite3-dev

    is what made the difference, finally I could install the sqlite3 gem

  4. Thanks Matt! I was stuck installing the selenium-webdriver gem, but installing the ruby dev package fixed this error. I thought gems were supposed to figure out dependencies like this?

  5. It worked perfectly!

    sudo apt-get install sqlite3
    sudo apt-get install libsqlite3-dev
    sudo gem install sqlite3-ruby
    sudo gem install sqlite3

    Thank you very Sood for the suggestion!

Leave a Comment