A few folks asked this over the past weeks, and since I released preview1 version of RubyInstaller, wouldn’t be awesome I write a guide for it?
So, here we go
First, Getting Ruby
Please download from here one of the preview1 installers for Ruby.
For this demonstration, I’m going to use Ruby 1.9.1-p129. Downloaded, executed and installed to it’s default location C:\Ruby19
Now, start a Command prompt with Ruby (under start menu, inside Ruby 1.9.1-p129).

Getting SQLite3
As you may know, Windows do not came out of the box with libraries like SQLite3. For this, we are going to download it from Internet.
Going to SQLite downloads, under Precompiled binaries for Windows, download sqlitedll-3_6_16.zip and sqlite-3_6_16.zip. Those two packages contains the DLL (sqlite3.dll) and the command line executable for SQLite (sqlite3.exe).
Please extract those contents inside C:\Ruby19\bin
Now, let’s get the Ruby bindings for SQLite3
Getting SQLite3/Ruby bindings
As you may know, the preferred way to distribute Ruby libraries is using Gems. Users on other platforms usually compile themselves these components, using the mechanisms provided by the operating system distribution.
We are going to avoid the compilation process using pre-compiled binaries that has been cooked for us.
So, back to the Command Prompt with Ruby, let’s install the sqlite3 bindings:
gem install sqlite3-ruby --source http://gems.rubyinstaller.org
Adding --source help us indicate a non-standard location from where gems are going to be installed. RubyInstaller team has built and packaged special versions of these gems that we hope get published soon into RubyForge, the official place for gem distribution.
Once installed, you should see something like this at the screen:
Successfully installed sqlite3-ruby-1.2.4.1-x86-mingw32 1 gem installed
These special version of the gem are fat binaries, which means these can be safely installed on Ruby 1.8.6 or 1.9.1.
Getting Rails
Now it’s time to install and build a Rails application. First, let’s install the rails gem:
gem install rails
That command is going to take a bit, since is a 2MB or so download, and will install several of the Rails dependencies (ActiveRecord, ActionPack, ActiveSupport, etc). You should expect similar output to this:
Successfully installed activesupport-2.3.2 Successfully installed activerecord-2.3.2 Successfully installed actionpack-2.3.2 Successfully installed actionmailer-2.3.2 Successfully installed activeresource-2.3.2 Successfully installed rails-2.3.2 6 gems installed
Let’s build our application now.
Creating a Rails application.
Let’s call the application railsapp
rails railsapp
An excerpt of the output you should get:
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
create db
...
Rails 2.3.2 defaults it’s database format to SQLite3, so there is no need for us to tweak anything.
Checking if everything is ok, using script\about:
cd railsapp ruby script\about
And the output should be something like this:
About your application's environment Ruby version 1.9.1 (i386-mingw32) RubyGems version 1.3.4 Rack version 1.0 bundled Rails version 2.3.2 Active Record version 2.3.2 Action Pack version 2.3.2 Active Resource version 2.3.2 Action Mailer version 2.3.2 Active Support version 2.3.2 Application root C:/Users/Luis/railsapp Environment development Database adapter sqlite3 Database schema version 0
Now, it’s up to you create your models, controllers and everything.
Some notes and considerations.
At the time of this writing, Mongrel has not been updated to build and install properly either on 1.9 or MinGW versions of Ruby.
As part of Mongrel development team, I’m going to work on a solution for this in the upcoming days.
If you find something wrong with the Ruby Installer, please report here, but issues with your code, Rails or other are not responsability of RubyInstaller.
The binary gems provided at gems.rubyinstaller.org are based on our forks of sqlite3-ruby, which can be cloned and explored here at GitHub.
Keep in mind that some gems would not work under Ruby 1.9, or you will need a compiler (DevKit) for it. See previous post with details how to get those from our download page.
5 Trackbacks
You can leave a trackback using this URL: http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/trackback/
RubyInstaller: Getting Started with Rails and MySQL…
This is a follow up instruction set from previous post, but this time, using MySQL
Getting Ruby
These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer from here
For this guide I’m going to use Ruby 1.9.1-p1…
[...] is a follow up instruction set from previous post, but this time, using [...]
[...] http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3 [...]
SQLite3/Ruby 1.2.5 Released!…
I just released an updated version of SQLite3/Ruby, officially to RubyForge!
Read the news here
This release includes binaries for Windows, but not any kind of binary, but fat ones!
That means that using either 1.8 or 1.9 versions of Ruby you will be a…
[...] Don’t forget to read a getting started guide here [...]
7 Comments
Thanks so much for your work on this! I’m looking forward to giving this a whirl.
Wow this looks much easier than my instructions for compiling by source
http://programming-gone-awry.blogspot.com/2009/05/ruby-19-one-click-installer.html
http://programming-gone-awry.blogspot.com/2009/05/how-to-install-sqlite3-binaries-on-ruby.html
=r
This rocks–I was completely failing to get sqlite installed on my xp machine at work. Love the fat binaries!
Thanks for posting this! I am staring to learn RoR now and tried it and on my PC, Vista Home Premium service pack 1, running Ruby 1.8.6. After this initial success:
Successfully installed sqlite3-ruby-1.2.4.1-x86-mswin32
1 gem installed
It tried to do the following documentation install:
Installing ri documentation for sqlite3-ruby-1.2.4.1-x86-mswin32…
Installing RDoc documentation for sqlite3-ruby-1.2.4.1-x86-mswin32…
And spewed out masses of error messages. Couldn’t capture them all, here is a sample:
No definition for _wrap_new_CallbackData
No definition for _wrap_CallbackData_proc_set
No definition for _wrap_CallbackData_proc_get
No definition for _wrap_CallbackData_proc2_set
No definition for _wrap_CallbackData_proc2_get
No definition for _wrap_CallbackData_data_set
No definition for _wrap_CallbackData_data_get
No definition for _wrap_sqlite3_libversion
No definition for _wrap_sqlite3_close
No definition for _wrap_sqlite3_last_insert_rowid
No definition for _wrap_sqlite3_changes
No definition for _wrap_sqlite3_total_changes
No definition for _wrap_sqlite3_interrupt
No definition for _wrap_sqlite3_complete
No definition for _wrap_sqlite3_complete16
No definition for _wrap_sqlite3_busy_handler
No definition for _wrap_sqlite3_busy_timeout
No definition for _wrap_sqlite3_set_authorizer
No definition for _wrap_sqlite3_trace
No definition for _wrap_sqlite3_open
No definition for _wrap_sqlite3_open16
That goes on for pages. What should I do?
Chong Kee
You might have missed putting the sqlite files in C:\Ruby\bin.
i had a similar problem as chong
and jhon’s solution fixed it for me
many thanks
Thanks, Luis. This saved me a lot of time messing around with nmake. Much appreciated.