Why can’t I install the SQLite gem?

The SQLite RubyGem isn’t actually a RubyGem, it’s a “CGem”, IOW it’s written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do that it needs the C header files for the Ruby interpreter.

If you compile Ruby yourself, those header files will be installed automatically, however, in RedHat-ish systems, such header files are usually packaged in a seperate package, called <whatever>-dev. So, in this case you will need to install the ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well.

However, you might be better off just installing your Operating System’s pre-packaged libsqlite3-ruby package, that way all the dependencies are automatically satisfied.

(Note: all package names pulled out of thin air, might be different on your system.)

Leave a Comment