How to Install and Run Ruby on Windows

By Christopher Haupt

To run Ruby on Windows, you have to install Ruby and several developer tools. The following instructions have been tested with Windows 8 and 8.1.

  1. Go to Ruby Installer in your web browser.

  2. Click the big red Download button.

    A list of RubyInstallers appears.

  3. Click Ruby 2.2.2 near the top of the RubyInstallers list.

    Click Ruby 2.2.2 to download installer.

    Click Ruby 2.2.2 to download installer.

    Do not click Ruby 2.2.2 (x64).

    An installer program downloads to your computer.

  4. Run the installer program by choosing Run Program (if Windows presents this option) or double-clicking the file when it’s done downloading.

    The installer will ask you to select a language to use during installation. Accept the license, and then the installer will have you set some configuration options. Leave the default folder choice alone, but uncheck the Install Tcl/Tk Support check box, and make sure that the other two check boxes — Add Ruby Executables to Your PATH and Associate .rb and .rbw Files with This Ruby Installation — are selected.

    Setup Ruby installation settings.

    Setup Ruby installation settings.

When the installer is done, it will have created a topmost folder with all the Ruby software on your C: drive called C:Ruby22. You can use Windows 8 Desktop and the File Explorer to confirm that it’s there (as shown here).

Confirm that the Ruby22 folder is created.

Confirm that the Ruby22 folder is created.

You must also download the Development Kit from Ruby Installer to get some of the cool tools used by your Ruby projects. Follow these steps:

  1. Go to the Ruby Installer in your web browser.

  2. Scroll down to the Development Kit section and click the file under “For use with Ruby 2.0 and above (32bits version only)”.

    Download the Development Kit for Ruby 2.0 and above. Be sure to click the 32bits version.

    Download the Development Kit for Ruby 2.0 and above. Be sure to click the 32bits version.

    An installer program downloads to your computer.

  3. Run the Development Kit installer by choosing Run Program (if Windows presents this option) or double-clicking the file when it finishes downloading.

    The installer will ask you where to put the kit. You want to put the kit in its own folder, not in the Ruby folder you selected in Step 1. To make things easy for your projects, select a folder next to the Ruby22 one at the top of your C: drive.

  4. Enter C:DevKit for the location, as shown here.

    Select the DevKit installation directory.

    Select the DevKit installation directory.

Now you need some final setup. Follow these steps:

  1. Open your Windows launch screen (or use the Start Menu).

  2. Click the Start Command Prompt with Ruby program.

    Click Start Command Prompt with Ruby.

    Click Start Command Prompt with Ruby.

    If you have a lot of programs installed in your launch screen, use the search feature and type command to help narrow down the choices.

    In the command prompt application, you type commands to get things done. Typing commands is a low-level way of working with a computer. Before the mouse and graphical interface was invented, this was the only way to tell the computer what to do!

  3. Change your location to the Developer Kit folder.

    When you first open the command prompt application, you’re usually in your home directory. To complete setup, you need to move to the DevKit directory. The display will show you a prompt that gives a hint of where you’re starting from:

    C:Userschris>

    Remember, you don’t need to type the prompt part, just the command line itself.

    Change folders by typing cd DevKit and pressing the Enter key to tell the computer you’re done with that command.

    You see the prompt change to your new location:

    C:Userschris > cd DevKit
    C:DevKit>
  4. Use Ruby to set up more Ruby tools.

    Development Kit has a Ruby setup program called dk.rb that you use for a couple of different steps. Enter the first command and watch for it to complete, as shown.

    Initialize the Development Kit.

    Initialize the Development Kit.
    C:DevKit> ruby dk.rb init

    If you see the Initialization complete! message, Development Kit is ready to finish installing its tools.

  5. Enter the install command and wait for it to complete:

    Install the Development Kit.

    Install the Development Kit.
    C:DevKit> ruby dk.rb install

    Phew! You only have to do these commands once to get your computer ready for Ruby programming and you’re almost there!

  6. The Development Kit is ready and now you can install Ruby gems (little add-on enhancements for Ruby).

    Enter the command and review the progress messages:

    Install the Gosu gem.

    Install the Gosu gem.
    C:DevKit> gem install gosu

    You may get a Windows security warning saying that Ruby is trying to use the network. This is okay — you can select the default values in the dialog box. You may have to enter your password to dismiss the dialog box.

Wow, that was a lot, but now you have Ruby installed!

Now you will want a code editor to help make writing your programs easy:

  1. In your browser, go to Atom and click the Download Windows Installer button.

    Download the Atom Editor.

    Download the Atom Editor.

    Atom is a free, powerful code editor that can be used for programming many different computer languages. It works well with Ruby.

    An installer program downloads to your computer.

  2. Run the Atom installer by choosing Run Program (if Windows presents this option) or double-clicking the installer program when it finishes downloading.

    You see a progress dialog box. When the installer is done, the Atom editor starts up.

    You see the Atom welcome screen, which means you’re all set to start programming with Ruby!

    The Atom welcome screen.

    The Atom welcome screen.

Ruby is constantly being updated and improved. The current release of Ruby at the time of this writing is version 2.2.2. Ruby uses a versioning scheme where the first number is the major version, the second number is the minor version, and the third number is the current build number (sometimes called the patch number).

On Windows, to utilize the game programming library Gosu, it’s important to select the version of Ruby and the Development Kit that indicate they are 32 bit.