2008/09/12

sqlite3-ruby gem on Windows

My fellow colleauge ran into a problem installing sqlite3-ruby gem on a Windows XP box. In Rails 2 we can use a lightweight database for development, SQLite. As it is a default db option for Rails, I don't see why they do not ship the gem during standard install as a dependency.

Anyways, installing SQLite is as easy as that. Go to SQLite downloads page and grab the sqlite-3-xxx.zip and sqlitedll-3-xx.zip archives and extract them eg. to C:\sqlite3. Add this folder to your system PATH environment variable so you (and your apps) can access the libraries and executables.

I suppose you have gem installed (and you installed Rails via this nice package management system), so let's the magic happen. In your console type:



Here you go. Why the versioning you'd ask. Unfortunately the gem 1.2.3 needs some compiling and header files you might not have on XP box. For standard gem commands see the RubyGems Manual. I recommend you to clean up your gems some time with



Update: This solution is considered to be temporary. For getting more recent and decent version of the library, please open up the rubyforge project page and download the latest gem package marked mswin32 or x86-mingw32 respective to your Ruby build. Then do eg.:



Update2: Roger from All Gems kindly put two solutions to the problem at hand. Both of them using Mingw, which is great. So here is Roger's post on building sqlite3-ruby binding binaries on Windows. The other post is from Luis Lavena, developer of the Ruby Installer which I definitely recommend to use on Windows.

Have fun!

7 comments:

Anonymous said...

works like a charm, thanks

Cos said...

Thanks!

Anonymous said...

thanks, this one works :)

Anonymous said...

thx a lot :)

Anonymous said...

worked fine for me, thanks

roger rubygem rdocs said...

it's either use that version or use the new mingw one click installer

http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/

or compile by hand mingw:

http://programming-gone-awry.blogspot.com/2009/05/how-to-install-sqlite3-binaries-on-ruby.html

Janos Hardi said...

Nice posts Roger, I'll update my own with these links as better follow up solutions. Thanks!