Installing Ruby on Rails
The programming projects for this class require you to use Ruby 1.9.2 and
Rails 3.2.1. If you don't already have these packages installed on your laptop,
follow the instructions below to install them. Note: these instructions are for
Ruby 1.9.2, but we believe version 1.9.3 will work equally well, and some of the
installers will install 1.9.3 by default.
The installation process is different depending on whether you
are running Windows, MacOS, or Linux:
Windows
- There is an all-in-one installer available at
http://railsinstaller.org/.
Click on the large "Download Kit" button and follow the instructions.
This will install Ruby, Rails, Sqlite, plus a few other things such
as git.
- Once the installer has completed, open a command window and type
the following command to upgrade to Rails 3.2.1:
gem install rails -v 3.2.1
Mac OS X
- Recent versions of Mac OS X have Ruby and Rails installed by default,
but you will need to upgrade to version 1.9.2 of Ruby and version 3.2.1
of Rails.
- To get started, you will need to install XCode, but note that
you will NOT be developing in XCode, you just need to have it
installed. You can grab the dmg file here:
http://developer.apple.com/technology/xcode.html. We recommend
the iPhone version if you have any interest in doing iPhone dev
at any point. Also, you'll have to sign up for a free ADC account
to download XCode.
- If you don't already have gcc installed, you will need to install it.
To see if gcc is already installed, type "gcc" in a shell window and see
if the command is found. If not, you can get gcc from
https://github.com/kennethreitz/osx-gcc-installer/downloads.
- Check your version of Ruby by typing "
ruby -v"
in a shell window. If you are not running version 1.9.2, you will
first have to install rvm
, then use it to upgrade
Ruby. To install rvm
, follow the instructions at
https://rvm.beginrescueend.com/rvm/install/.
Once rvm
is installed, upgrade Ruby with the following
shell commands:
rvm install 1.9.2
rvm use 1.9.2 --default
- Once you are running Ruby 1.9.2, you can upgrade to Rails 3.2.1
with the following command:
gem install rails -v 3.2.1
- Install Sqlite3. Mac OS X should already have Sqlite3 pre-installed,
so all you need to do is install the Ruby connector:
This may print out several warning messages, which you can ignore.
If this prints error messages, it may be that you don't have Sqlite3
pre-installed; Google "sqlite3 install macos" to find out how
to install it.
Linux
We don't officially support Linux for this class, so you will be mostly on your
own if you want to use it. However, we think the following instructions may
work:
- Check to see if Ruby is already installed with the correct version
by typing "
ruby -v"
. If it prints version 1.9.2 then
you can skip the next few steps.
- Install
rvm
by following the instructions at
https://rvm.beginrescueend.com/rvm/install/.
-
Once
rvm
is installed, invoke the following shell commands,
which will upgrade Ruby to 1.9.2 and make that the default version of
Ruby on your machine.
rvm install 1.9.2
rvm use 1.9.2 --default
- Once you are running Ruby 1.9.2, you can upgrade to Rails 3.2.1
with the following command:
gem install rails -v 3.2.1
- Install Sqlite3. Download the file
sqlite-3.7.0.1.so
and copy it to the directory
containing the Ruby executable. Then use the
Gem system to install the Ruby connector:
This may print out several warning messages, which you can ignore.