Installing Rails on Windows (step-by-step tutorial)

January 9, 2006

20 July 09 Note – The new version of the Rails Windows installation guide is there. And the great news is that I even did it on the Rails v.2.3.3, released today! Please follow the instructions in this new guide, they are the most up to date ones!

28 June 09 Note – If you are new to Ruby / Rails, you should also get yourself acquainted with the Ruby syntax here.

Ok, so this will basically be somewhat a repeat of the information made by Curt Hibbs in this great hands-on tutorial. However, the versions of all products changed from the time Curt made his tutorial, and in some areas I felt that additional description was required. So, in this tutorial you’ll get a step-by-step instructions on installing Rails on Windows 2000 Server (Windows XP would be very similar).

In order to have a fully working development environment, you can use your PC. You will need to install:

  • Ruby – the language
  • Ruby Gems – the plug-in manager for Ruby
  • Scite or FreeRIDE – IDE for Ruby
  • MySQL – the database
  • MySQL query builder / MySQL admin tools – GUI to create databases, add users and create tables
  • Rails Framework

I. Installing Ruby
This is easy. Just get the latest One-click Installer for Windows (currently 1.8.2-15). Installation is simple, and indeed one-click. Once the installation is complete, check that path to ruby\bin directory is in your PATH variable (Run “cmd”, then type “path” at the prompt and check that the path is there.

The great thing about the one-click installer is that it comes with Ruby Gems, Scite and FreeRIDE preinstalled. The thing to watch out for is that one-click installer does not have the very latest version of Ruby, so when you are reading Ruby Docs, make sure you know which version of Ruby you have (run “ruby -v” in the command prompt).

II. Installing MySQL
This might be more tricky, depending on your home computer’s set up. First, download and run the latest Windows Essentials (x86) version of MySQL (currently 5.0.18). After the files are unzipped, an Instance Config should run automatically (you can run it manually at any time from your MySQL bin directory just run “MySQLInstanceConfig.exe”).

Below are the options to use for the Instance Configuration.

1. Select “Detailed Configuration”

p1.jpg

2. Choose “Developer Machine”

p2.jpg

3. Choose “Multifunctional Database”

p3.jpg

4. Leave the next screen unchanged

p4.jpg

5. Choose “Decision Support / OLAP”

p5.jpg

6. From the security perspective it is better to have “Enable TCP/IP Networking” unchecked, however I wasn’t able to make MySQL work with Rails in that case. So, choose “Enable TCP/IP Networking” for now and leave “Strict mode” checked.

p61.jpg

7. Choose “Best Support for Multilingualism” (MySQL will use Unicode for stored data).

p7.jpg

8. Have both options checked.

p8.jpg

9. Now, create a password for root account. Make sure that you do not use an easily guessable password and do NOT leave these fields blank (ie, do not use blank password for root). Also, leave the “Enable root access from remote machines” unchecked.

p9.jpg

10. Click “Execute”. If everything went ok, you should have green tick marks for all installation steps.

p10.jpg

11. Now, you need to do some basic security tweaking, to make sure nobody hacks your database from the outside. Go to the MySQL directory (c:\mysql by default), open my.ini and add the following line to the [mysqld] section of your server configuration file:

bind-address=127.0.0.1

This line will make sure that only services from your localhost will be able to access database (so, this means you and your web server).

Now, you need to restart MySQL. Go to Services (In Windows 2000: Start -> Programs -> Accessories -> Administrative tools -> Services), find “MySQL”, highlight it, click “Stop” and then “Start” icon.

12. Quickly try if your mysql set up is working, by running this command in the prompt:

mysql.exe -h 127.0.0.1 -u root -p

You will be asked to type your password and if everything is fine, should be presented with the message “Welcome to the MySQL Monitor” and the mysql prompt. It works! You are almost there.

If it does not work – first, make sure that you are entering the password right (check Caps Lock and Language Indicator). Check that MySQL service is running (see step 11). Another usual suspect is your local Firewall (your router firewall will not interfere with the local MySQL installation). A quick fix would be to allow communication for ruby.exe and mysqld-nt.exe on all ports (check your Firewall manual or help).

III. Installing Rails

1. Go into the ruby bin directory and run this command from the command prompt:

gem install rails --include-dependencies

(If this command gives you an error, you do not have the latest version of gems installed. Run “gem -v”, it should be 0.8.10. If it’s an earlier version, I recommend to reinstall the newest package – see beginning of the tutorial).

This command will install rails 1.0 and RDoc documentation for it. It should take up to 5-10 minutes, so do not worry when for a couple of minutes you just see a message “Updating Gem source index for: http://gems.rubyforge.org/” – there is no progress bar or any other indication of activity, but it is doing the work.

At the end you should see something like this:

p11.jpg

2. After that, create a directory for all of your projects. I just have one in the ruby directory. Go into this directory by using the “cd c:\ruby/myprojectsdir” and run

rails firstproject

You should see something similar:

p12.jpg

3. Finally, “cd firstproject” and run

ruby script/server

This will run the file “server” (no extension) in the script subdirectory of “firstproject directory”, which will in turn run the Rails built-in web server WEBrick. Test the web server by opening the following address in your browser:

http://127.0.0.1:3000/

You should see the following pic:

p131.jpg

One of the drawbacks of having a Ruby-based web server is that WEBrick needs to run in its separate command prompt window, so you should be careful not to close the window down incidentally, or you will need to restart the web server.

Congratulations! YOU ARE ALMOST DONE!

IV. MySQL Admin

Here, you have several options, however the tool I love the most – MySQL Control Center – is no longer in development. You can still download it here (v.0.9.2) or here (v.0.9.4). Or you can download MySQL Administrator and Query Browser from MySQL.com. I haven’t tried those tools yet, so I will show how to work with MySQL CC, but the steps will be very similar.

Note on MySQL CC and MySQL Administrator / Query Browser:
MySQL CC is not fully compatible with MySQL 5.x, so it might be better to use Administrator and Query Browser. However, MySQL CC is a very easy to use bare-bones program and it allows to do everything you need in this tutorial. If you opt for Administrator / Query Browser set-up, you would use the Administrator only for creating database users (and in future for setting up security, back-ups and restarting MySQL). For all other things you will use the Query Browser (in the Query Browser databases are called “Schemas”, and when you first run QB, you can safely ignore the warning to supply the schema name).

1. Install MySQL Admin and run it.

2. Create a new database connection by clicking the icon shown (or press Ctrl-N):

p14.jpg

3. Fill out the information as shown in the picture below:

p15.jpg

Name: This is any name you want – for GUI purposes only. Call it “My Development Database”.
Host name: This would be either “localhost” or “127.0.0.1″. On some weird configs “localhost” might not work, so try to use either one.
User name: “root”. Leave it as is.
Password: your root password. Remember setting it when installing MySQL? ;)
Make this server the default connection: If you do not have any other databases, tick this box. By running MySQL CC next time, you will automatically connect to the database.

Now, click the “Test” icon, and if successful, click “Add”.

4. Create the database.

Go to the main console. It now should have your database “My Development Database”. Check that it is connected, if not click the “Connect” icon.

Right click on the “Databases” folder and select “New database”. You will be presented with the following prompt. Just name the database “firstproject”, although it does not really matter how you call the database.

p16.jpg

5. Now, back to the main console window, you should see the database name “firstproject” in the list of databases for your server. Double click on the database and then click on the “Tables” subfolder. It should look something like this:

p17.jpg

6. Now, the database for your project has been created, you need to create a test table. Right click the “Tables” folder and choose “New table”. Let’s make two fields: id (type: int) and title (type: varchar).

“id” field is required by Rails and is the usual feature for the majority of tables. You do not usually insert the “id” directly, so we need to make sure that “id” is never empty (not null) and is automatically incremented (0,1,2,3,…). Also, make sure that the “id” is written in lowercase, for Rails to understand that this is your unique id field.

p18.jpg

Now, let’s define “id” as our primary field. Go into the “indexes” tab, select “id” field and press the right arrow, it should end up looking something like this:

p21.jpg

Now, add the “title” and choose the type “varchar”, like this (length of 100 symbols should be enough for your title, but when you will be adding a field for url you would want to change it to 255):

p19.jpg

Finally, click the “Save” icon and you will be asked to name your table. Rails has a special notation for naming tables – basically they have to be in plurals, as they will hold instances of particular class (objects).

Let’s call the table “Stories” (Rails is supposed to know the plural form for “Story”, so let’s try it out). Go back to the main console window and double click the “Tables” subfolder. On the right you will see the list of tables (we have only one at the moment – called “Stories”). Double click the table, it should return an empty set, as you do not have any records yet. (Do not try to create a record – MySQL CC will not correctly do this in MySQL 5.x).

7. Finally, it would be wrong to run your project using a root password. So, you need to create the database user especially for your project. It is very easy to do. In the main console right-click on the “User Administration” folder and select “New User”. Fill out the form as shown:

p22.jpg

Username: rails (this would be the username exclusively used for your project)
Host: localhost
Password: password you will use to access this user account
Priviliges: You should provide the least possible priviliges for the user. The ones selected by default are ok, but you can actually safely leave priviliges to only “Select, Insert, Update and Delete”, as we do not plan to create, drop (delete) or alter (change structure of) tables from our Rails scripts. Finally, select, to which databases you are allowing access. Select ONLY the “firstproject” database and click “Add”.

V. Rails in action

1. Now that the database model was prepared, we need to switch it on for our project. Go into your rails project subdirectory (you remember where you created it, right?). In the “config” subfolder you will find file database.yml. Open it and find the “development” section. In it, change database name to “firstproject”, username to “rails”, password to rails user password. Leave socket unchanged. Here is how it will look like:

development:
  adapter: mysql
  database: firstproject 
  username: rails
  password: railspass55
  socket: /path/to/your/mysql.sock

In order for those changes to work, you will need to restart the WEBrick server. Close the WEBrick window and run the server command again:

ruby script/server

2. You have the database schema defined and you configured Rails to access your database. Now, what we need is to create the class called “Story”. The easiest way to go is to create a scaffold, which is basically a default script to work with the standard database operations under the acronym of CRUD (Create Read Update Delete or in SQL terms: INSERT, SELECT, UPDATE and DELETE). To do this, again go to your script’s directory and run this command:

ruby script\generate scaffold Story

Make sure that you use the capital “S” – this is actually a Ruby rule that you need to follow – class names need to be capitalized. So, this is where the magic happens – you do not need to define the class in Ruby the “hard-way”. You define the class variables (so-called states) only once – in the database, and then those variables are automatically recognized by Rails and a standard CRUD framework is applied, which you can replace with your own code as you go.

3. Finally, check that everything works by going to this link: http://127.0.0.1:3000/stories/

For fun, try creating, updating and deleting records and see how the table records are automatically updated in the MySQL CC or Query Browser.

IN CONCLUSION
Installing Ruby on Rails is not a difficult process, but it takes some time. However, once installed you will not only feel comfortable with basic MySQL administration, but will also get a development environment which is much faster and easier to use than a hosting based alternative.

So, what next? Now, it’s probably time to learn Ruby and Ruby on Rails. I’ve learned Ruby and Rails from 3 great books that I link to on my blog. And if you are looking for free Rails web resources, I posted about them here.

Entry Filed under: Uncategorized. .

129 Comments Add your own

  • 1. Fidel Guajardo  |  January 12, 2006 at 5:42 pm

    Just want to point out that the command above that reads:
    gem install rails –include-dependencies

    has two dashes before “include”. The cmd window screenshot correctly shows the two dashes but the inline text does not.

    Thus the correct command should read:
    gem install rails –include-dependencies

    Reply
  • 2. allaboutruby  |  January 13, 2006 at 12:27 pm

    Fidel, you are correct, the parser or dhtml editor replaced two dashes with a single em dash. I fixed it. Thank you!

    Reply
  • [...] well, I think next good step in mastering Ruby after Installing Rails on Windows (step-by-step tutorial), would be taking a look at the real Ruby web-application such as a Typo (another weblog engine) and then try to compare its source code with its rival analog: a typical web-application written on PHP (yet another weblog engine) which author obviously should be familiar with ;-) [...]

    Reply
  • 4. Jaygiri  |  January 28, 2006 at 9:24 pm

    Thanks.. you saved my time.

    Reply
  • 5. essam  |  February 17, 2006 at 2:21 pm

    thank you,i found this much helpful for me

    Reply
  • 6. budee  |  February 21, 2006 at 5:28 am

    How to install rails without connect to internet?

    thx

    Reply
  • 7. allaboutruby  |  February 21, 2006 at 10:17 pm

    budee: Get the gem package here: http://rubyforge.org/frs/?group_id=307

    Reply
  • 8. Ivana  |  March 14, 2006 at 3:31 am

    Hi,

    I had a TCP/IP port for mysql: 3308 and I had to add the following to the database.yml file in order to get the scaffold to get created:

    development:
    adapter: mysql
    database: firstproject
    username: rails
    password: railspwd
    socket: /path/to/your/mysql.sock

    # Connect on a TCP socket. If omitted, the adapter will connect on the
    # domain socket given by socket instead.
    host: localhost
    port: 3308

    I didn’t touch the socket variable. I had to uncomment the host and port and set them to what mysql is running at (the way it was installed on my machine).

    I am guessing that for any port you’d have to add those last two variables (if mysql was enabled for TCP/IP). I am running MySQL 5.0.19.

    This tutorial saved me a lot of pain. I still got stuck twice so I am having learning pains. But then, if it was easy, I’d be worried about my mental health. It definitely is a new way of thinking. Takes time to get used to. Thank you for the effort to make it easier for us.

    Ivana

    Reply
  • 9. anamik  |  March 14, 2006 at 8:31 pm

    Hi,

    How and where shud one install “the gem package from here: http://rubyforge.org/frs/?group_id=307” ..if one has already installed ruby package using the one-click ruby installer, you have mentioned

    Reply
  • 10. anamik  |  March 14, 2006 at 8:34 pm

    i am kind of new to the technology.. and wud appreciate your help a lot..

    Reply
  • 11. Amit Goyal  |  March 20, 2006 at 4:21 am

    Same question as anamik. How to install the gem package and rails offline?

    Reply
  • 12. Gilbert  |  March 21, 2006 at 4:00 pm

    Almost the same as Ivana, but now I’m having the following when trying to execute:

    ruby script\generate scaffold Story

    NO CONNCTION COULD BE MADE BECAUSE THE TARGET MACHINE REFUSE IT..

    The MySQL DB is in a local network machine and is accessed by other tools very quickly.

    So what would be the right changes to the database.yml file when it comes to the path of the database?

    Reply
  • [...] _ All About Ruby | Installing Rails on Windows (step-by-step tutorial) Ok, so this will basically be somewhat a repeat of the information made by Curt Hibbs in this great hands-on tutorial. However, the versions of all products changed from the time Curt made his tutorial, and in some areas I felt that additional description was required. So, in this tutorial you’ll get a step-by-step instructions on installing Rails on Windows 2000 Server (Windows XP would be very similar). [...]

    Reply
  • 14. Stephen  |  March 28, 2006 at 9:19 pm

    When you can’t “gem install rails –include-dependancies” because you are behind a corporate firewall and you need to authenticate (-p http://proxy:port is not enough), and then you are told to go to http://rubyforge.org/frs/?group_id=307 and DL the Rails package, then you extract the zip file because you are working on Win2K, what are you suppose to do with the Rails installation files? How to you install Rails at that point? Thanks for your help.

    Reply
  • 15. toft  |  March 29, 2006 at 10:22 pm

    There are “a couple” of developers out there with sql server running on their windows machines already..

    All you need to do if you want to use ruby on rails with sql server is install ruby-dbi (with ruby, see the README). Download it from http://rubyforge.org/projects/ruby-dbi/.

    This example for configuring database.yml was taken from the ruby on rails wiki:

    adapter: sqlserver
    database: database_name
    host: DBI:ADO:Provider=SQLOLEDB;Data Source=server_name;Initial Catalog=database_name;User Id=user_name;Password=your_pw_here;
    username: user_name
    password: your_pw_here

    This worked directly without problems for me.

    Reply
  • 16. PI  |  April 1, 2006 at 7:41 am

    Hi there,
    I need some help please…I am a Ruby newbie – using MySQL Front for GUI database manipulations on MySQL database/server, I am this morning, not able to connect to the database. I guess this is actually a MySQL problem rather than Ruby. I have used a blank password as suggested, but when I attempt connecting via MySQL Front, I encounter the error message: ” Cannot connect to MySQL Server on “localhost”!”
    I get a similar response when i test my connection within DOS using the mysql.exe -h 127.0.0.1 -u root -p command. Prompted to enter a password, I leave it blank as I earlier mentioned- resulting in a similar error message. Everything worked fine just yesterday. What can I do? Thanks for helping

    Reply
    • 17. JBONE  |  September 4, 2009 at 12:57 am

      go to start-> settings -> control pane -> l administrative tools–>component services –>services

      find MySQL

      right click and restart

      or

      restart the MySQL server through the software might work too

      Reply
  • 18. perraut  |  April 17, 2006 at 4:06 pm

    My problem is as soon I set a password in the database.yml file, I get an syntaw error when starting again the webrick server ! the webrick server is able to start coorectly as soon as I leave the password blank in database.yml, but then of course I can’t connect my application to the database.
    Can somebody help me, great thanks

    Reply
  • 19. Doc Pepin  |  April 21, 2006 at 4:42 am

    I don’t have a local internet connection, is there some way i can install ruby on rails offline, where i can copy the necessary installers from a nearby internet cafe and install them at my home pc?

    Reply
  • 20. LAu  |  May 22, 2006 at 2:38 pm

    I’m, also lookng for installing rails on a disconected PC , i could install gems but I need a lot ofe dependencies for installing rails : rake , …

    Reply
  • 21. josh  |  May 23, 2006 at 5:27 pm

    I can’t get my rails WEBbrick to open right it tells me http://0.0.0.0:3000/ and that doen’t work. Do you know what maybe wrong? email me if you can help joshspoonATgmail.com

    Reply
  • 22. Vamsi B  |  May 24, 2006 at 6:28 pm

    Excellent article!!! Being a beginner to RoR, I configured and ran my sample rails application in just 1 hr. Rails is gonna rock the web development. Cheers!!!!!!!!!

    Reply
  • 23. Greg N  |  June 21, 2006 at 10:00 pm

    when I run:

    ruby script/generate scaffold Product Admin

    I get the following error message:

    #2800Access denied for user ‘root’@'localhost’ (using password: NO)

    I have set a pasword on my MySQL root account. Where in RubyOnRails is the script, so I can enter the password and get the application installed?

    Would really appreciate some direction, I just can’t figure out which script where. It was very late…..(smile)
    Thanks in advance,
    G

    Reply
  • 24. Like Your Work » Blog Archive » links for 2006-07-12  |  July 12, 2006 at 12:26 am

    [...] All About Ruby | Installing Rails on Windows (step-by-step tutorial) (tags: ruby) [...]

    Reply
  • 25. Gaurav  |  July 21, 2006 at 6:23 pm

    Its a really nice tutorial for getting people started. Now I have got ruby & rails up & running.
    Thank you.

    Reply
  • 26. Rahul  |  July 26, 2006 at 6:57 am

    I have same query

    How to install rails without connect to internet?

    Thanks

    Reply
  • 27. Flavia  |  August 1, 2006 at 12:33 pm

    See this link if you need to install Rails without an internet connection:

    http://lists.rubyonrails.org/pipermail/rails/2006-June/047469.html

    Reply
  • 28. Vishnu  |  September 16, 2006 at 12:49 pm

    when i run command ruby script\generate scaffold Story
    i get befor updating scaffolding from new DB schema ,try creating a table for your model(Story)

    actuall i have 5 tabel in my database and i run this data base with other app
    very good
    can any one help me ??\

    Reply
  • 29. Deepak Kapoor  |  September 20, 2006 at 10:26 am

    Excellent tutorial for all beginners. i have just configured ruby with its all functionality (gems and all that). it has taken 5 hours to configure properly. but atlast em able to run samlple add/edit/delete record pages. the whole credit for this goes to you all only… thanks for this tutorial.. BEST OF LUCK!

    Reply
  • [...] If you’re using windows, try the article from All About Ruby for step by step intall: Installing Rails on Windows If you’re using linux, try the article from Paul Goscicki for step by step install: Installing Ruby on Rails on Ubuntu [...]

    Reply
  • 31. Ben Reichelt’s Weblog » Learning Ruby on Rails  |  September 23, 2006 at 3:16 am

    [...] I installed everything based on this tutorial I found.  The installation was even easier than expected since I already had MySql installed and thats the meat of the installation instructions. [...]

    Reply
  • 32. namrata  |  October 2, 2006 at 11:49 am

    there is some problem in gem installation because of that rail is not getting installed. can u tell me what to do for that?

    Reply
  • 33. ikenna4u  |  October 6, 2006 at 10:21 am

    cool artice! thanks

    Reply
  • 34. paddy  |  October 15, 2006 at 11:44 pm

    Great article, nothin left out saved me a sore head cheers!

    Reply
  • 35. Pushkar Prasad @ IIT Kharagpur  |  October 23, 2006 at 8:05 pm

    The rails could be installed without connecting to net by installing the actionpack-1.12.5
    actionmailer-1.2.5
    actionwebservice-1.1.6
    etc.
    (a total of 6 files i guess )

    One could easily get them by googling

    Once you dld them , install each by “gem install ”

    Example:-
    ********************************
    C:\ruby\bin>gem install actionmailer-1.2.5

    C:\ruby\bin>”c:\ruby\bin\ruby.exe” “c:\ruby\bin\gem” install actionmailer-1.2.5

    Attempting local installation of ‘actionmailer-1.2.5′
    Successfully installed actionmailer, version 1.2.5
    Installing RDoc documentation for actionmailer-1.2.5…

    C:\ruby\bin>

    ********************************

    Finally when all are installed , install rails with following command

    C:\ruby\bin>gem install rails

    If all the files are installed , rails will be installed

    Reply
  • 36. RoR « In God’s Country  |  December 10, 2006 at 3:38 am

    [...] Installing Rails on Windows (step-by-step tutorial) [...]

    Reply
  • 37. kray  |  December 10, 2006 at 9:22 am

    Being new to rails ive got some error in installing rails at start…

    Its on the part of the ri documentation will it affect the installation?

    At the database I can’t make the “Stories” table.. it is now “stories” Will this affect the end result..

    Also im experiencing this error at the command:
    ruby script\generate scaffold Story

    Routing Error
    Recognition failed for “/stories/”

    when accessing the http://127.0.0.1/stories/

    What could be the problem with this sir? Thank you in advance.

    Reply
  • 38. romyaspe  |  December 10, 2006 at 12:20 pm

    how do you install ruby on rails in windows which has already a wamp server running?

    Reply
  • 39. romyaspe  |  December 10, 2006 at 12:41 pm

    I wanted to test out the rubricks cms on my wamp server. please assist me in installation.

    Reply
  • 40. memberhack  |  December 19, 2006 at 2:40 am

    thank for help install ruby on rails for windows

    Reply
  • 41. Christine  |  December 22, 2006 at 5:53 pm

    Wow! I am really impressed. That is a very well thought out and documented installation. Thank you so much!

    Reply
  • 42. FutureofCairns  |  January 3, 2007 at 2:34 am

    I would not have been able to get Rails going without this tutorial. However at the very last step of the tutorial, I encountered an Access Denied error ‘root’@'localhost’. Scanning forums indicate that other people have also come across this error. In my case the error was caused by not changing the default name of the database in the yml config file to ‘firstproject’. I was trying to use the default database name that is created by the rails firstproject command, which is ‘firstproject_development’. Truncate the development and things should work.

    I am using a newer version of ruby (1.8.5) and rails (1.1.6) and the MySQL Administrator than used in the tutorial, (current as of January 2007) yet differences to tutorial were minor.

    Reply
  • 43. Aftab  |  January 4, 2007 at 8:47 pm

    The VERY BEST ARTICLE that i was looking for. Nice screenshots for easy learning and cool explanations for those wanting to Learn Ruby Language and MySql.

    Great work! ^_^

    Thanks!

    Reply
  • 44. Brian  |  January 5, 2007 at 6:01 am

    This article was a very big help for me also. I also had to learn how to install the mySQL add-on module, make my app run after a restart, and set up my dev. environment, so I added some info in my own tutorial:

    http://jupiterit.com/wordpress/?page_id=36

    That might help out some people needing more help.

    Reply
  • 45. Gary  |  January 6, 2007 at 4:12 am

    exists app/controllers/
    exists ……
    ………….
    identical app/models/story.rb
    ………….
    error Before updating scaffloding from new DB schema, try creating a table for your model (Story)

    NOTE: wamp5 is running at the backend

    Reply
  • 46. Brian  |  January 7, 2007 at 5:37 pm

    Gary,

    That error means you need to create a table in your database called “stories”.

    Reply
  • 47. Zaheer Ijaz  |  January 26, 2007 at 12:05 pm

    Thanks. I am able to install ruby, rubygem and rails.

    Reply
  • 48. Mitch  |  February 3, 2007 at 2:20 am

    I was also getting the

    #2800Access denied for user ‘root’@’localhost’ (using password: NO)

    When i input a pasword the server would not start giving me a connection error. The solution is to make sure to keep the spaces in the database.yml file.

    Wrong:
    development:
    adapter: mysql
    database: firstproject
    username: ruby
    password:pass
    host: localhost

    Correct:

    development:
    adapter: mysql
    database: firstproject
    username: ruby
    password: pass
    host: localhost

    Hope this helps someone. Good tutorial.

    Reply
  • 49. Farrukh Shahzad  |  February 3, 2007 at 2:34 pm

    Beautiful!! Awsome!! and Ground Level Tutorial… I love it

    I read lots of lots of articles to do RubyOnRails using IIS or Apache but no server required with this Article that’s another beautiful thing

    Also with “Ivana” comments:
    ——
    # Connect on a TCP socket. If omitted, the adapter will connect on the
    # domain socket given by socket instead.
    host: localhost
    port: 3308
    ——-

    Every thing is working fine… BUT

    little tweaking/feedback from my side is:
    ————————————————————————-
    on Windows, MySQL is not case sensitive so field name “Id” and “id” are same.

    but using “Id” didn’t worked on my winXP+mysql4.1
    so you must see if your side is working or not, and also be careful for the case sensitive OS like Linux when you upload your scripts for production.

    Thanks

    Reply
  • 50. Alex  |  February 6, 2007 at 5:07 am

    Thanks hips!

    Nice step by step guide.

    Reply
  • 51. pravin  |  February 13, 2007 at 11:14 am

    how to resolve this error

    ERROR: While executing gem … (SocketError)
    getaddrinfo: no address associated with hostname.

    Reply
  • 52. Maulik Bhatt  |  February 24, 2007 at 6:54 am

    Help pls….

    Error : While executing gem . …….(Timeout::Error)
    execution Expired….

    What is the reason for this issue..?
    Pls tell me how to get rid of this.

    Thanx in Advance,
    Maulik Bhatt

    Reply
  • 53. C  |  February 26, 2007 at 6:03 pm

    Installing rails is too difficult. I begin to be disappointed.

    Reply
  • 54. Al Kozak  |  February 27, 2007 at 1:03 am

    This is great. Had no problems. The screencasts from http://www.rubyonrails.org/screencasts were helpful and fun to go along with. I’m also going to see how RadRails (http://www.radrails.org/) works later.

    well done…

    thanks

    Reply
  • [...] Ruby on Rails unter Windows aufsetzen wird hier beschrieben: Link [...]

    Reply
  • [...] Re: What Is RUBY? – Today, 11:43 PM Ruby on Rails used for Web Applications and very fast when compared to ASP.NET,PHP,ASP Ruby On Rails Downloads Download Ruby on Rails How To HowtoInstallOnOSXTiger in Ruby on Rails How to Install in Windows Installing Rails on Windows (step-by-step tutorial) All About Ruby [...]

    Reply
  • 57. Kris  |  March 15, 2007 at 9:09 pm

    Good tutorial … I was able to generalize most of this to WinXP + MySQL Query Browser + MySQL Administrator fairly easily. Thanks!

    Reply
  • 58. Gayal Rupasinghe  |  April 4, 2007 at 4:58 am

    Excellent piece of work.

    Reply
  • 59. Teabass » Getting Ryan on Rails - Part 1  |  April 16, 2007 at 1:58 pm

    [...] – There is an awesome tutorial on All About Ruby will tell you everything you need to get windows on rails, alternatively you can grab InstantRails [...]

    Reply
  • 60. Rex is Excited » Daily Links  |  April 17, 2007 at 8:51 am

    [...] Installing Rails on Windows (step-by-step tutorial) « All About Ruby For my school research / web programming, I need to host my site on a windows box. WHAT?! yeah, my school won’t give me admin privs to me on unix. (tags: toread RubyOnRails windows web) [...]

    Reply
  • 61. abhinav  |  May 4, 2007 at 2:53 am

    hi,
    excellent howto!
    when i use the ruby script/server command
    it says the following

    => Booting WEBrick…
    => Rails application started on http://0.0.0.0:3000
    => Ctrl-C to shutdown server; call with –help for options
    [2007-05-04 08:11:34] INFO WEBrick 1.3.1
    [2007-05-04 08:11:34] INFO ruby 1.8.6 (2007-03-13) [i386-mswin32]
    [2007-05-04 08:11:34] INFO WEBrick::HTTPServer#start: pid=2296 port=3000

    as you can see this rails starts on http://0.0.0.0:3000
    but i am able to access this page, the requested url shows not to be found.
    please help me out.Where could i have gone wrong?

    Reply
  • 62. nitesh  |  May 5, 2007 at 8:26 am

    hey
    i need help i install ruby,rails,mysql,fastcgi and all required gems. while making an application i got a mysql error i do no\t understand wht is this any body help me???

    Reply
  • 63. francisXV  |  May 15, 2007 at 8:28 pm

    thank you very much
    works perfectly with wamp ..

    Reply
  • 64. ahmed  |  May 16, 2007 at 12:14 pm

    thanks for the very useful article

    Reply
  • 65. Hemanth  |  May 17, 2007 at 1:53 pm

    hi
    any info is a great help to me

    Reply
  • 66. md  |  May 19, 2007 at 2:38 pm

    I’m stuck in MySQL Administrator’s first popup box “Connect to MySQL Server instance” using MySQL Administrator 1.2.12. I use Server Host 127.0.0.1 port 3000, username = root, password = prev entered password.
    The welcome page at http://127.0.0.1:3000/ is displayed and i’ve got the cmd-prompt with WEBrick running.

    Reply
  • 67. md  |  May 19, 2007 at 2:44 pm

    Never mind – I’m just stupid, MySQL wasnt running =)

    Reply
  • 68. Richard  |  June 19, 2007 at 10:40 pm

    Hey, great tutorial. I skipped the bit about using MySQL CC. You can just create one manually using PHPMyAdmin if you’ve done an xampp install. The moment I got a single form field on a web page that added my tiny title to the db I leaped! I’ve been toiling away writing scripts left right and centre using PHP for 2-3 years trying to avoid .NET and know I’ve got something I can use without going the proprietary software. Thank you.

    Reply
  • 69. Steven  |  June 24, 2007 at 10:16 pm

    Hi thnaks for the tutorial, but im having trouble installing MySQL :-( i keep getting:

    Error 1045

    Acess denied for user ‘root@localhost’ {using password: YES}

    says port 3306 is not working. So i switched off my firewall yet it still doesnt work. What can i do to open the port?

    can anyone please help me

    Reply
  • 70. dominic  |  June 30, 2007 at 10:56 am

    C:\ruby\myprojectsdir\firstproject>ruby script\generate scaffold Story
    exists app/controllers/
    exists app/helpers/
    exists app/views/stories
    exists app/views/layouts/
    exists test/functional/
    dependency model
    exists app/models/
    exists test/unit/
    exists test/fixtures/
    identical app/models/story.rb
    identical test/unit/story_test.rb
    identical test/fixtures/stories.yml
    getaddrinfo: no address associated with hostname.

    Reply
  • 71. ehurley  |  July 9, 2007 at 8:35 pm

    Great tutorial,
    Anyone got any similar info for deployment to windows server?
    Thanks!

    Reply
  • 72. Royce Tivel  |  July 22, 2007 at 10:45 pm

    Previously, I had installed instantrails on my W2K system: the process of adding Ruby and Rails to my existing testbed seemed too complex. However, after finding your tutorial, I was able to integrate Ruby/Rails into my existing testbed without difficulty–and I also installed mysqlcc.

    Thank you very much for this great tutorial; it gets a five-star rating from me.

    Royce Tivel
    http://www.selectdigitals.com

    Reply
  • 73. yacatl  |  August 2, 2007 at 5:01 pm

    After 3 years hearing about it, today finally decided to install it. It was a bit difficult to find a how to reference to install rubyonrails into windows, is very easy to install just ruby, with your tutirial was quite easy to do it.

    I just had one problem but was a mysql grant permissions user. I had the user but no the database permssions to manipulate the database I created, so, when I restarted the webbrick server an error just happened, if I puted on the root user I was abble to rerun rhe server but no to generate the scaffold.

    Finally I set up the permissions and also a password to my user (not the root) and was abble to reach the final section. Now, ¿how can I start to programm?

    Greetings!

    Reply
  • 74. Prabhat  |  August 6, 2007 at 3:08 pm

    Excellent documentation. It works, I followed the each and evry steps one by one. If any body having any issues with the installation steps please ping me at prabhatrishi@rediffmail.com

    Regards,
    Prabhat

    Reply
  • 75. Prabhat  |  August 6, 2007 at 3:12 pm

    If any body did the installation on RHEL4 then please do let me know the steps.

    Note: Please visit http://slideshare.net/prabhtrishi

    Regards,
    Prabhat

    Reply
  • 77. Patrick  |  August 21, 2007 at 2:34 pm

    Thank you for the great article. For my development setup this works pretty well. I like it this way and I appreciate the steps listed. It offers some core understanding of Ruby’s background!

    Thanks again,

    regards, Patrick

    Reply
  • 78. Mamendes  |  September 5, 2007 at 2:27 am

    Does it *make* me name my tables with Capital first letter or make the db case insensitive?
    Or else it won’t work, running the examples by the book.

    Reply
  • 79. Adım Adım Ruby On Rails Kurulumu | Gürkan OLUÇ  |  September 10, 2007 at 11:22 pm

    [...] Windows Üzerinde ( Her ne kadar performans açısından kötü olsada ) kurmayı anlatacağım. Çeviri yaptığım makalede veritabanı olarak MySQL‘i nasıl yükleyeceğinizden de bahsediyor ancak biz şimdilik o [...]

    Reply
  • [...]  http://allaboutruby.wordpress.com/2006/01/09/installing-rails-on-windows-step-by-step-tutorial/ [...]

    Reply
  • 81. Tobi  |  September 24, 2007 at 7:33 pm

    excellent tutorial-worked perfectly!

    Reply
  • 82. Ruby, Rails, Mysql and Windows Vista | so I was thinking…  |  October 20, 2007 at 12:33 am

    [...] box over to Windows vista.  Not bad, everything installed as expected.  I used this great walk-thru I found on the web for setting up Rails on a windows machine.  It was easier to get the dev [...]

    Reply
  • 83. FoRsAkEnKiD  |  December 4, 2007 at 5:56 pm

    This was really helpful for me. Thanks.

    \m/ FoRsAkEnKiD \m/

    Reply
  • 84. Peter Sinclair  |  December 5, 2007 at 2:33 am

    Thanks so much, this was incredibly helpful!

    Reply
  • 85. Maximus  |  December 20, 2007 at 9:04 am

    I would like to see a continuation of the topic

    Reply
  • 86. Minimus  |  December 21, 2007 at 2:15 pm

    I get stuck at the “cd firstproject” part (step III, number 3). I get an “Invalid directory” message whenever I type in “cd firstproject” at the “C:\RUBY\BIN>” prompt. Everything was working fine up to that point. What should I do? Thanks for any help.

    Reply
  • 87. Ajeet Singh  |  January 7, 2008 at 10:15 am

    Excellent tutorial , would like to have more .

    Reply
  • 88. Amanda  |  January 12, 2008 at 2:22 am

    Thank you!!! This was wonderful. You have explained this so well, and I got it all to work!

    Reply
  • 89. Kaspars  |  January 27, 2008 at 8:03 pm

    thank You, that was really useful.

    Reply
  • 90. Nancy  |  February 8, 2008 at 7:11 pm

    This is a great tutorial — thanks a lot for posting it. Server Intellect, our Windows host, has been really good at handling any issues for us that may arise, which makes the whole process a lot easier than it has been in the past.

    Reply
  • 91. roobnoob  |  February 14, 2008 at 1:27 am

    Note that on cygwin, i kept getting “NO such file or directory – /tmp/mysql.sock” even though no socket file existed anywhere, nor was i setting the socket property in database.yml.

    The workaround was to set the host and port property in the database.yml file:

    host: 127.0.0.1
    port: 3306

    Using “localhost” gave me the same error as above, it had to be 127.0.0.1

    Reply
  • 92. Mainfram Reality » Ruby on Rails on Windows  |  February 25, 2008 at 8:15 am

    [...] blog has a nice post/tutorial dealing with the subject. As a bonus it includes installing MySQL.Installing Rails on Windows (step-by-step tutorial)There is also Instant Rails package. This package includes Ruby, Ruby on Rails, Apache and MySQL all [...]

    Reply
  • 93. Naren  |  February 29, 2008 at 1:28 pm

    This was a very useful article.
    I got the app running, however, my screen doesn’t show the ‘title’ field. It shows the “New” link and when I click the “Create” button, I do see that a record has been inserted in the DB but with the title as empty.
    What could be the problem?

    Reply
  • 94. MaddyTheGoose  |  March 5, 2008 at 5:51 am

    I have the same problem as Naren.

    Very useful article bu I don’t see the ‘title’ field when I run the app.

    Any information on this would be very much appreciated.

    Reply
  • 95. Ruby on Rails for Windows Developers | TechToolBlog  |  March 5, 2008 at 9:12 pm

    [...] Installing Rails on Windows, Step by Step Tutorial [...]

    Reply
  • 96. Nishu  |  March 13, 2008 at 7:48 am

    one easy way is to use “instant ruby” on windows

    Reply
  • 98. Asad Siddiqi  |  March 29, 2008 at 1:56 am

    Great work !!
    This got me up and running in no time . Highly appreciate it . I have been more of a dot net developer but the features i have heard of here are simply fantastic . I wanted to be up with the environment . Hats off to you !! Thanks

    Reply
  • 99. Jaya  |  April 10, 2008 at 6:31 pm

    Hi,
    I followed the tutorial above and now i created a table in my db and got it as something like http://127.0.0.1:3000/trials/. I have 2 rows and it shows the edit,show and other options alone with the content of my rows, i had given the previlages for select stmt and others also in my db, what could be the problem

    Reply
  • 100. Not So “Instant Rails” « blakes  |  May 14, 2008 at 12:19 pm

    [...] So I obviously need to do some investigating.  While looking for a good tutorial I found this post that is for an older version or Rails but does a great job of screen shots for install. [...]

    Reply
  • [...] Installing Rails on Windows Posted by Soy Optimist Filed in Uncategorized [...]

    Reply
  • 102. csstrickery  |  June 13, 2008 at 6:16 pm

    Hi,

    When I type:

    cd c:\ruby/firstpro I get a syntax error? And I cant restart my server again :(

    The CMD for Ruby is called ruby.exe, and located in the bin folder?

    Reply
  • 103. HansVDZ  |  August 20, 2008 at 2:25 pm

    To show the id and title on the screen, follow next steps:
    1. change ‘index.html.erb’: add the following 2 lines just before link_to ‘Show’

    2. replace ‘new.html.erb’ with this:
    New story

    Title:

    3. replace ‘edit.html.erb’ with this:
    Editing story

    Title:

    |

    4. replace ’show.html.erb’ with this:

    |

    It is not a nice layout, but it is just for showing the id and title.

    Reply
  • 104. HansVDZ  |  August 20, 2008 at 2:40 pm

    Ok, my previous comment is not a great succes so I will try it again and now using de code-tags.
    For issue 1.

    Reply
  • 105. Jef  |  August 20, 2008 at 2:42 pm

    You can use:

    ‘test1′
    or
    “test2″

    Reply
  • 106. HansVDZ  |  August 20, 2008 at 3:08 pm

    1. change ‘index.html.erb’: add the following 2 lines just before link_to ‘Show’
    <td><%= story.id %></td>
    <td><%= story.title %></td>

    2. replace ‘new.html.erb’ with this:
    <h1>New story</h1>

    <% form_for(@story) do |f| %>
    <%= f.error_messages %>
    <table>
    <tr>
    <td><label for=”story_title”>Title</label>:</td>
    <td><%= text_field ’story’, ‘title’ %></td>
    </tr>
    <tr>
    <td><%= f.submit “Create” %></td>
    </tr>
    </table>
    <% end %>

    <%= link_to ‘Back’, stories_path %>

    3. replace ‘edit.html.erb’ with this:
    <h1>Editing story</h1>

    <% form_for(@story) do |f| %>
    <%= f.error_messages %>
    <table>
    <tr>
    <td><label for=”story_title”>Title</label>:</td>
    <td><%= text_field ’story’, ‘title’ %></td>
    </tr>
    <tr>
    <td><%= f.submit “Update” %></td>
    </tr>
    </table>
    <% end %>

    <%= link_to ‘Show’, @story %> |
    <%= link_to ‘Back’, stories_path %>

    4. replace ’show.html.erb’ with this:
    <table>
    <tr>
    <td><%= @story.id %></td>
    <td><%= @story.title %></td>
    </tr>
    </table>
    <%= link_to ‘Edit’, edit_story_path(@story) %> |
    <%= link_to ‘Back’, stories_path %>

    Reply
  • [...] 1. สำหรับในส่วนแรกจะเป็นการ install Ruby และ Rails ครับซึ่งในส่วนนี้สามารถอ่านวิธีการอย่างละเอียดได้ ที่นี้ [...]

    Reply
  • 108. thnakyou  |  September 4, 2008 at 12:46 am

    Hi Thanks a lot for your post and this has helped me to install everything I needed from ground up.

    Reply
  • 109. free world  |  September 20, 2008 at 1:10 pm

    I love this simple put together tutorial. It was real straight forward. Can you or anyone else place more tutorial regarding other frameworks/languages: Python, PHP, etc.

    Reply
  • 110. Rob Henrichon  |  September 26, 2008 at 5:45 am

    Hello All,

    How can I get Ruby on Rails up and running?

    I already have a successful Wamp server setup with Apacvhe, PHP, and mySQL running locally on my machine. I do not want to “destroy” that setup by using the “All in One” Ruby Installer which includes the Apache server and mySQL in it’s installation.

    How do I just get Ruby on Rails along with the Framework and Gems and other stuff that is required installed? I purchased a Ruby on Rails book from Sitepoint.com but I see nothing in the book that explains what to do if you already have your PHP serving up and running. It seems they want to just throw this “whole installer package” deal at you.

    Thanks Much for any Help!

    Regards,

    Rob Henrichon

    On Track Computer Solutions
    “ONE SINGULAR GOAL . . .
    increasing client revenues /
    through defined computer solutions.”

    voice: 802-236-2038
    email: ontracksolutions@comcast.net

    Reply
  • 111. Dilip  |  October 29, 2008 at 12:36 pm

    Can I install Ruby on the wamp ?

    tell me the site for proper guidence of to run fist ROR program

    Thanks,
    Dilip S.

    Reply
  • 112. Dilip  |  November 3, 2008 at 12:30 am

    Dilip,
    u don’t need the wamp.
    Rails comes with its own web server to be run out of the box and it is multi platform, which means, runs on windows.

    Reply
  • 113. Dilip  |  November 3, 2008 at 12:33 am

    Dilip,
    u don’t need the wamp.
    Rails comes with its own web server to be run out of the box and it is multi platform, which means, runs on windows.
    And you can skip the mysql installation. you can connect to ur wamp mysql (i’m doing this) or the bundled sqlite

    Reply
  • 114. Marcos  |  December 5, 2008 at 3:11 pm

    Do I HAVE to use WEBrick?
    What if I already have Apache installed?

    Thanks!

    Reply
  • 115. hagiwhat  |  February 3, 2009 at 8:15 pm

    great post..

    Reply
  • 116. Agilo.us » Blog Archive » Rails on Windows  |  March 15, 2009 at 7:03 am

    [...] to All About Ruby for providing a starting point for my research for this [...]

    Reply
  • 118. Aminul Islam  |  March 31, 2009 at 7:09 am

    i am using windows XP. i was doing fine until following step. while i run
    D:\ruby\bin>gem install rails –include-dependencies
    it wait for a long while which is not a problem for me. but after waiting it gives me following

    Bulk updating Gem source index for: http://gems.rubyforge.org
    D:/ruby/lib/ruby/1.8/yaml.rb:133: [BUG] rb_gc_mark(): unknown data type 0×0(0×1d
    ruby 1.8.6 (2007-09-24) [i386-mswin32]

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application’s support team for more information.

    Please note that, currently my internet speed is too slow. is it the reason? i don’t think so.

    Reply
  • 119. Aminul Islam  |  March 31, 2009 at 11:09 am

    I have an update. When my internet connection is faster the same command(gem install rails –include-dependencies) gives me the following output. But still some error shown

    D:\ruby>gem install rails –include-dependencies
    Bulk updating Gem source index for: http://gems.rubyforge.org
    Successfully installed rails-2.3.2
    Successfully installed rake-0.8.4
    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
    Installing ri documentation for rake-0.8.4…
    Installing ri documentation for activesupport-2.3.2…
    Installing ri documentation for activerecord-2.3.2…
    Installing ri documentation for actionpack-2.3.2…
    d:/ruby/lib/ruby/1.8/irb/slex.rb:35: [BUG] Segmentation fault
    ruby 1.8.6 (2007-09-24) [i386-mswin32]

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application’s support team for more information.

    Reply
  • 120. Pradeep Pant  |  April 15, 2009 at 4:30 am

    Really Nice tutorial. I got an error while accessing http://127.0.0.1:3000/stories page. The error is thrown by ruby.exe. it was unable to locate LIBMYSQL.dll component. I have tried to do gem install mysql but didn’t work. Then finally copied the LIBMYSQL.dll file manually from Mysql installation bin path to ruby bin folder. After following these steps I am able to see the Stories page.

    Reply
  • [...] lu sur ce blog qu’il était préférable de rajouter le suffixe [...]

    Reply
  • 122. Amit  |  June 10, 2009 at 9:04 am

    I found this article very helpful.Well, can anyone tell dat is there any way to set mysql permanently as my database server for ROR applications?….Right now i have to set it for each and every project config/database.yml file.

    Reply
  • 123. Andrea  |  June 17, 2009 at 3:06 am

    Thanks so much! helped alot!

    Reply
  • 124. Adım Adım Rails Kurulumu « gurkanoluc  |  June 28, 2009 at 6:12 pm

    [...] Windows Üzerinde ( Her ne kadar performans açısından kötü olsada ) kurmayı anlatacağım. Çeviri yaptığım makalede veritabanı olarak MySQL‘i nasıl yükleyeceğinizden de bahsediyor ancak biz şimdilik o [...]

    Reply
  • 125. Sam  |  July 6, 2009 at 9:50 pm

    Thanks for the installation help.I was struggling to install it until I found this page. Great Work.

    Reply
  • 126. Augusto  |  July 19, 2009 at 10:47 pm

    I’m trying to test my first Rails app in a already existing code that’s in c:\stepgreen.org\

    After running most of your steps (and adding the correct tables in the database) I ran

    $ ruby script/server

    on c:\stepgreen.org\, but I can’t see nothing on http://localhost:3000 (and I’m redirected to http://www.strepgreen.org:3000/

    Supposedly I have o add

    127.0.0.1 localhost pittsburgh.stepgreen.dev http://www.stepgreen.dev

    on c:\windows\system32\drivers\etc\hosts

    But this doesn’t solve anything :/

    Reply
    • 127. allaboutruby  |  July 19, 2009 at 11:26 pm

      I don’t know why you’re redirected, but you should actually access 127.0.0.1:3000 (unless you changed the defaults) and not the localhost.

      Reply
  • 129. Max  |  October 19, 2009 at 5:40 pm

    This is a really great tutorial for Windows users with screen shots. It is a very in depth tutorial. If you are just looking to get started with Ruby on Rails, please check out the article at: http://topcweb.com/content/ruby-rails-setup

    Reply

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Archive

Recent comments

gogetakame on Installing Rails on Windows (3…
gogetakame on Installing Rails on Windows (3…
allaboutruby on Installing Rails on Windows (3…
Harsha on Installing Rails on Windows (3…
Eddy Josafat on Google Maps API in Rails (YM4R…