The Ruby Teaching Edition for Macintosh
The Ruby Teaching edition for Macintosh is designed to be easily installed on a
The Ruby Teaching Edition works on Mac OS/X 10.5 - but Mac OS/X 10.5 already has
Ruby and Rails installed - so you may want to simply use the versions of this software
that comes with Mac OS/X 10.5.
This installation also includes the SQLite3 Database Browser
(http://sqlitebrowser.sourceforge.net/) to allow us to explore the contents of our SQLite3
databases that we will use with Rails.
Installing Ruby Teaching Edition for Macintosh
Download the latest version from:
Extract the file to your desktop - you should end up with a single directory called "rte-
mac" - that directory should contain a file named "rsu.sh" and a subdirectory called ruby
and hopefully this documentation.
This rte-mac directory can be installed anywhere including your Desktop, Home
Directory, a Shared File Server, USB drive or a USB stick. A USB stick will be
somewhat slow - but may be your only choice in a shared environment.
To install - simply move or copy the rte-mac to the desired location. Once you have it
installed, continue with the instructions below.
Using the Rails Training Environment for the Macintosh
These instructions are to be followed anytime you want to start a new application or
simply work on an existing application. We will do much of the control of our Rails
environment through the Macintosh Terminal program. Start the terminal program under
Applications -> Utilities -> Terminal.
You might want to keep the Terminal program in your Dock by clicking on the terminal
icon in the Dock and holding until a menu pops up.
Once the menu pops up select Keep in Dock and the terminal will be available in a single
Once you are in the terminal, you use the cd command to get into the rte-mac directory.
In this Example, the ret-mac directory is on the Desktop. Once you are in the rte-mac
directory, type the commands as shown below. The output should be similar.
Once you have checked the ruby, rails, and gem commands. The only steps that are
needed are to start the terminal, use cd to get into the rte-mac directory, and type the
source rsu.sh command - from that point you can start developing your rails
You can develop your rails applications in any directory you like - in this example, we
will simply put them in a directory called rails_apps in the rte-mac directory.
The rails command creates a new application as shown in the output below. The
application is named "zork" in the example below and stored in a directory named "zork".
The "-d sqlite3" indicates that we would like our Rails application to use the SQLite3
The rails command creates a large number of files - effectively writing our first
$ cd Desktop/rte-mac/
$ source rsu.sh
Setting up Ruby Environment
$ cd rails_apps/
$ rails zork -d sqlite3
[ …. Snip …. ]
Once this is complete, we will go into the newly created "zork" directory and start the
Ruby web server for our new application.
$ cd zork
$ ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not
** Mongrel available at 0.0.0.0:3000
** Use CTRL-C to stop.
Once this step is completed, you can access your new Rails application by opening a
browser and pointing it to http://localhost:3000/
You can click on "About your application's environment" and check to make sure that it
is using the sqlite3 database.
All that is left is to shut down your web server. To do this we go back to the terminal.
You should see some log information as your server was talking to the browser. You can
press Control-C in the terminal to abort the web server.
Your test of the Ruby Training Edition for Macintosh is now complete. You can create
and run Rails applications.
Make sure to do the source rsu.sh command from the rte-mac directory each time you
start a new window - or the rails and ruby command will not work properly.
Using RTE for the Macintosh on a USB Stick
To install the Ruby Teaching Edition onto a USB Stick, simply copy the rte-mac
directory onto the USB stick.
You should make sure that the name of your USB stick has no spaces like the USB stick
To rename the USB stick gently single click on the words below the stick and it should
allow you to change the volume label on the USB Stick. You can name it anything you
like - just make sure there are no spaces.
When you insert a USB stick into your Macintosh, the drive is mounted under the
/Volumes directory using the disk name.
So to navigate to the rte-mac directory o the USB stick you simple change to the proper
directory as shown below:
$ cd /Volumes/NONAME/rte-mac/
SQLite Database Browser 1.3.app rsu.sh
$ source rsu.sh
Setting up Ruby Environment
$ rails --version
All of the rest of the operations work the same as if the Ruby Training Edition were
installed on your hard disk.
Because running from a USB stick is slower - you might want to copy the ret-mac
directory onto your desktop each time you work in a shared environment - it is about
60Mb - it takes about 30 seconds to copy. Make sure not to lose your work however
when you move form computer to computer - you need to know where your Rails
applications have been edited and copy them back to the USB stick before you leave the
Copyright and Notes
This material is Copyright 2007, 2008, Charles Severance - Creative Commons
Attribution 2.5. You are welcome to use, reuse, adapt or remix this material in any way
you feel useful. If you find mistakes or suggest improvements please contact the author.
If you are teaching Rails - I highly recommend this book: Build Your Own Ruby on Rails
Web Applications by Patrick Lenz (http://www.sitepoint.com/books/rails1/).
Please visit www.rubylearn.com to see if there is updated or additional materials
available. I am anticipating a growing community of people who want to teach Ruby and
Rails at the High School, and College level - I would like to see us developing and
sharing materials as much as possible so we can focus on teaching as well as we can
rather than always building materials from scratch individually.
Dr. Charles Severance
February 3, 2008