University of Oregon

Note About Ruby 1.9

The RubyLabs modules were developed with Ruby 1.8.7. The software mostly works with Ruby 1.9.1, but there is one place where a module will not pass its unit tests: the HashLab module used for Chapter 6 ("When Words Collide").

Users running Ruby 1.9.1 will be able to create hash tables, and the hash functions all work, but the locations they create are not consistent with the values described in the text.

Lab Setup Script

If you get an error message when you type the command that runs the lab-setup.rb script click the link below to download a copy of the script. Save this file in your home directory, then retype the command that runs the script.


Software Installation

To work on the tutorial projects in Explorations in Computing you need to install three different software packages:

  1. The Ruby programming language.
  2. A library called Tk, which is used to draw images on the screen in projects that include interactive visualizations.
  3. A set of modules known as RubyLabs, which contain the software used in the tutorial projects.

Each installation is a straightforward matter of downloading a single software package and using the default configuration parameters.

1. Install Ruby

Ruby is a programming language that is widely used by web page developers and other software professionals. It is open source software, and can be freely downloaded and installed on any computer.

Note:   Make sure you install Ruby version 1.8.7 and not Ruby 1.9 (see the note at left for more information).

Microsoft Windows:   Show Instructions

Linux:   Show Instructions

Mac OS X:   Show Instructions

2. Install Tcl/Tk

Tcl/Tk is a software package that is widely used for creating windows, buttons, and other parts of graphical user interfaces. The RubyLabs modules use Tcl/Tk for projects that display graphics on the screen during an experiment. The version of Tcl and Tk we use comes from an organization called ActiveState.

Microsoft Windows:   Show Instructions

Linux:   Show Instructions

Mac OS X:   Show Instructions

3. Install RubyLabs

Ruby programs that developers want to share with other programmers are typically distributed as "Ruby gems". The RubyLabs modules are installed by an application that connects to a "gem server" to download the RubyLabs gem.

Microsoft Windows:   Show Instructions

Linux:   Show Instructions

Mac OS X:   Show Instructions

Test the Software

The method for making sure all the software has been downloaded and installed properly is the same for all systems.

Start your terminal emulator and type the following command to start an interactive Ruby session:


When Ruby starts the prompt should change to a double greater-than sign (>>). Type hello and hit the return key.

If everything was installed correctly two things will happen: RubyLabs will print a friendly greeting in the terminal window, and it will create a graphics window with another "hello" message.


The instructions shown above for installing Ruby, Tk, and the RubyLabs gem are explained in more detail in the Lab Manual. The Lab Manual also has describes some of the things that can go wrong during the installation process and offers some suggestions for how to fix problems.