Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having a problem trying to install the SQLite3 RubyGem. Here's what I'm doing:

$ sudo gem install --remote sqlite3-ruby

Here's the output:

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
checking for fdatasync() in -lrt... yes
checking for sqlite3.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/ext/sqlite3_api/gem_make.out
share|improve this question
can you post the contents of /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/ext/sqlite3_api/gem_make.out – Sathya Jan 4 '10 at 14:58
the contents of that file ended up being exactly the same as what I originally posted – Andrew Jan 5 '10 at 4:16
is there a mkmf.log file in the same directory? – Sathya Jan 6 '10 at 11:42

Here's your answer:

First I install the Sqlite3 database:

sudo apt-get install sqlite3

After this we install the lib so we don’t get the error:

sudo apt-get install libsqlite3-dev

Now we can install the gem without the error:

sudo gem install sqlite3-ruby

The first command (installing sqlite3) may not be necessary.

share|improve this answer
Worked for raspberry pi as well. – sam452 Jul 29 '15 at 13:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.