Ruby on Windows

Ruby does not come pre-installed on Windows systems. To work with Ruby programs on Windows, Ruby needs to be manually downloaded and installed.

You can get Ruby from the following: http://rubyinstaller.org/. Simply click the link for the one-click windows installer and select the latest stable release. Download the file and launch the installer. When asked, go ahead and put check marks next to all of the components to install. Everything else can remain as the defaults.

Ruby programs can be created using any text editor such as EditRocket. Ruby programs and scripts typically end with the .rb extension. EditRocket will automatically recognize files with the .rb extension as Ruby programs, and will color the syntax accordingly.

To create a Ruby program, simply create a new file, such as hello.rb. In the file, place the following:

puts "Hello, world!"

The above script can be executed using the EditRocket Tools -> Ruby -> Execute Program option, or you can execute it from the command prompt. To execute the script via the command prompt, use the cd command to cd to the directory where the hello.rb file was saved, such as

cd C:\Scripts

Then type the following:

C:\Ruby\bin\ruby.exe hello.rb

Hello World! should then be printed to the screen.

For more information about runing Ruby programs via a local Apache web server, see the following:

Running Ruby with the Apache Web Server on Windows