Be Alert When on SQLite 3

This trips everyone up, so let's be clear:

If you are on Windows:

  1. gem install sqlite3-ruby --source http://code.whytheluckystiff.net
  2. Choose the most recent mswin32 version: sqlite3-ruby X.Y.Z (mswin32)

If you are on Mac, Linux, BSD:

  1. Install sqlite3 (SQLite 3 download page).
  2. Lastly, gem install sqlite3-ruby --source http://code.whytheluckystiff.net
  3. Choose the most recent ruby version: sqlite3-ruby X.Y.Z (ruby)

If you are on Mac OS X 10.4

Mac OS X 10.4 ships with version 3.1.3 of SQLite, which is incompatible with acts_as_versioned. If you try and run some of the samples with this version, you'll get an error similar to this one when trying to initialize the database:

SQLite3::SQLException: near "ADD": syntax error:
ALTER TABLE tepee_pages ADD "version" integer (ActiveRecord::StatementInvalid)

In order to avoid this error, upgrade to a newer build of SQLite3. The samples have been tested and work with version 3.4.1, but may work with versions as early as 3.2.0 (this hasn't been tested).

cabo: On a Mac running Mac OS X 10.4, you may have to do MACOSX_DEPLOYMENT_TARGET=10.4 gem install sqlite3-ruby to allow certain linker flags to work. Without the environment variable setting, I get build errors and then the plain Ruby version.

If you are on Ubuntu (Dapper)

You need to make sure to execute 'sudo apt-get install build-essential', required to build native extensions and not installed by default. Also you need to install 'ruby1.8-dev' (instead of 'ruby1.8') otherwise the native extensions will not be built. The same goes for 'libsqlite3-dev'.

zimbatm : I'm using the libsqlite3-ruby1.8 package which seem to work perfectly well. manfred: Yes, libsqlite3-ruby on Debian Etch is confirmed.


Return to CampingRulesOfThumb.