Install Ruby on Windows
This article is obsolete. It describes how to install the Ruby "One-Click Installer," which has since been replaced. However, since the One-Click Installer is still preferred by some, you may prefer to continue reading. If not, please read the new article covering the new installer.
The "one-click installer" bundles the Ruby interpreter, documentation, some popular libraries and a text editor all into one handy installer.
Difficulty: Easy
Time Required: 15 minutes
Here's How:
- Download the latest version of the one click installer from either the Ruby download page or the Ruby Installer homepage.
- Once the file is finished downloading, execute it and follow the directions in the installer to complete the installation.
- Click on Start -> All Programs -> Ruby-xxx-xx.
- To start the bundled editor for Ruby files, click on SciTE.
- To start the graphical documentation browser, click on fxri.
- Right-click in any folder, such as the Desktop or My Documents, and go to New -> Ruby Program.
- Give your Ruby program a name, but be sure to keep the .rb extension or it won't be recognized by the interpreter.
- Right-click on the file and click Edit.
- The SciTE editor should launch with a blank file. Copy the example program from the box below and paste it into the SciTE editor and then click File -> Save.
#!/usr/bin/env ruby
puts "Hello world!"
gets# Wait for the user to hit enter - Go back to the folder in which you started and double-click on the file. If everything went well, you should see a black command-prompt window with the text "Hello world!" displayed.
- Hit enter or click the command-prompt's close button to close the window.
Tips:
- The fxri program that is bundled in the installer can be used as a Graphical User Interface replacement for the ri (Ruby Interpreter) command you might wish to use. This is particularly helpful for beginners because instead of having to type in a command, the GUI provides you with a clickable widget to perform the same action.
- Though there are some great text editors out there for Windows--Notepad++ or Vim come to mind--the SciTE text editor included with the one-click installer is associated with all .rb files and is already set up to edit Ruby files.
Source...