Building SQLite
May 02, 2006These are instructions are for building SQLite from source. SQLite is a fantastic little database, and favorite of mine when building Rails apps that center around things like content management and blogging. I’ll do a longer post in the future on why and when to choose SQLite over bigger more traditional databases like MySQL, Postgres, SQL Server, and Oracle.
Sorry Windows users, these instructions are for OS X and Linux/Unix people, but fear not, the SQLite homepage has prebuilt binaries for you.
A quick note: These instructions are in the same vein as Dan Benjamin’s “how to build from source” instructions on Hivelogic and he has plenty written on why to use /usr/local and how to get the prerequisites set up on your machine. If you don’t have /usr/local in your path, and don’t have the build tools set up yet, go take a look at those two articles and come back when you’re done. It’s not scary, I promise.
Back? Great, continuing…
Getting the SQLite Source
First you need to get the source for SQLite. Make sure you’re in your temp directory first for downloading the source code.
curl -O http://www.sqlite.org/sqlite-3.3.5.tar.gz tar xvzf sqlite-3.3.5.tar.gz cd sqlite-3.3.5
Building SQLite
Next is the build process, which is just as easy.
./configure --prefix=/usr/local make sudo make install cd ..
Final Steps
Well, really, there aren’t any final steps, you should have a functional install of SQLite working now, but to test it type:
sqlite3 -version
...and you should see the output:
3.3.5
You also might want to clean up your temp build directory by running:
rm -rvf sqlite-3.3.5 rm -f sqlite-3.3.5.tar.gz
If all has gone according to plan you now have a working install of SQLite, and are free to enjoy the pleasures of a small, fast, file based, zero config database.