So it’s not like this doesn’t exist elsewhere on the ‘net, but in case you stumbled upon one of my other Ruby on Rails posts and I caught your interest, here’s how to get started developing Rails apps on Windows. If you’re a little resistant to try Rails, look how simple the install is. What are you waiting for?
Head over to http://rubyinstaller.org/ and install Ruby executable from there. I usually install both 1.8.7 (current release Ruby 1.8.7-p249 (RC2)) and 1.9.1 (current release Ruby 1.9.1-p378 (RC2)) and use pik to switch between the two with ease. I also have the RubyInstaller set my path variable to include the install path for Ruby 1.8.7. The RubyInstaller includes Ruby and RubyGems. If you are not familiar with RubyGems, a gem is a Ruby package. Accessing and using a gem is a simple
gem installcommand, which you will see in a moment.
Fire up cmd on your machine and type
ruby -v. You should see the following text. If you don’t, check your PATH variable and make sure you have an entry for your installation path (typically C:\Ruby\bin). Note your version listing may be different than mine.
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
You may want to update RubyGems. The RubyInstaller (at least at the time of writing) includes v1.3.5. To do this, use the command:
gem update –systemThe current version as of this post is v1.3.6. You can check your gem version with the command **gem -v
Now it’s time to install Rails, which thanks to gems is as easy as running the command:
gem install rails. Note that installing Rails takes a bit of time. After Rails is done, use the command
rails -vto verify it installed correctly.
After Rails is done, you should install a database. The easiest to get going with is SQLite. You’ll need to download the EXE and the DLLs for SQLite (from here: http://sqlite.org/download.html). Look under the Precompiled Binaries For Windows section. You’ll have three files after downloading the two zip files (sqlite-3 and sqlitedll). Put the sqlite3.dll, sqlite3.def, and sqlite3.exe in your Ruby\bin directory (typically C:\Ruby\bin). Once you’ve done that you’ll need to install the sqlite3-ruby gem, which is just:
gem install sqlite3-ruby
That’s it! Now you can start working with Rails. Let’s make a simple note taking application…