Update: Rails 3 is now available. The instructions below should also work for the final release.
Update 2: MySQL2 gem (starting with version 0.2.5) officially works for Windows. See gist.
Installing Ruby using RubyInstaller should be straight forward. The installer automatically defaults the path to C:\Ruby192. If you have used DevKit in the past, you’ll notice this DevKit requires a different way to install. I highly recommend following the instructions here. You’ll need to remove the old DevKit install for other Ruby installations and install the new DevKit using the dk.rb script.
Install Rails 3 using the –pre parameter. Update: –pre is no longer necessary now that Rails 3 is official
c:\devkit>gem install rails --pre Temporarily enhancing PATH to include DevKit... Successfully installed activesupport-3.0.0.rc Successfully installed builder-2.1.2 Successfully installed i18n-0.4.1 Successfully installed activemodel-3.0.0.rc Successfully installed rack-1.2.1 Successfully installed rack-test-0.5.4 Successfully installed rack-mount-0.6.11 Successfully installed tzinfo-0.3.23 Successfully installed abstract-1.0.0 Successfully installed erubis-2.6.6 Successfully installed actionpack-3.0.0.rc Successfully installed arel-0.4.0 Successfully installed activerecord-3.0.0.rc Successfully installed activeresource-3.0.0.rc Successfully installed mime-types-1.16 Successfully installed polyglot-0.3.1 Successfully installed treetop-1.4.8 Successfully installed mail-2.2.5 Successfully installed actionmailer-3.0.0.rc Successfully installed thor-0.14.0 Successfully installed railties-3.0.0.rc Successfully installed bundler-1.0.0.rc.5 Successfully installed rails-3.0.0.rc 23 gems installed
If you read my previous Rails 3 post, we had to install a lot of the dependencies separately. The latest Rails gem seems to take care of it. Also, RubyInstaller comes with Rake, so you do not need to install it.
Next up is installing SQLite or MySQL (your preference).
Note: The official Rails blog mentions support for the MySQL2 gem which takes care of the MySQL encoding issues on Ruby 1.9.2. At the time of this writing, I could not install MySQL2 gem on my Windows box, but the gem author seems to be fully aware of the situation. In the meantime you should be able to use SQLite or MySQL with the mysql gem.
Let’s install SQLite:
c:\devkit>gem install sqlite3-ruby Temporarily enhancing PATH to include DevKit... ============================================================================= You've installed the binary version of sqlite3-ruby. It was built using SQLite3 version 126.96.36.199. It's recommended to use the exact same version to avoid potential issues. At the time of building this gem, the necessary DLL files where available in the following download: http://www.sqlite.org/sqlitedll-3_6_23_1.zip You can put the sqlite3.dll available in this package in your Ruby bin directory, for example C:\Ruby\bin ============================================================================= Successfully installed sqlite3-ruby-1.3.1-x86-mingw32 1 gem installed
The instructions above says to use SQLite version 188.8.131.52 and provides a link to the dll. I would also get the exe which is available here. Place sqlite3.dll and sqlite3.exe in C:\Ruby192\bin or a general bin directory in the PATH (thanks for the correction, Luis!).
Now let’s create a new Rails app. Note, the new command to create the app:
Start up the local server by running this command:
E:\p\rails\rails3rc>rails server => Booting WEBrick => Rails 3.0.0.rc application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-08-21 11:48:18] INFO WEBrick 1.3.1 [2010-08-21 11:48:18] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32] [2010-08-21 11:48:18] INFO WEBrick::HTTPServer#start: pid=4296 port=3000
Now you should see that familiar Welcome aboard page on http://localhost:3000/.
Now follow the Rails 3 Guide to build yourself a Rails 3 app!