To Documents
Ruby and Rails Installation
The version of Ruby used in the course and installed in the CDM computer labs is Ruby 1.9.3-p194; the version of Ruby on Rails
in the labs is 3.2.7.
Follow these directions to install the same version on your computer.
PC Ruby and Rails Installation
- Download the Ruby One-click Installer. Download Ruby 1.9.3-p194 at http://rubyinstaller.org/downloads/
to your harddrive. The download file is rubyinstaller-1.9.3-p194.exe.
- Install Ruby. In the Windows Explorer, double click on the rubyinstaller-1.9.3-p194.exe file and follow the directions. By default, Ruby will be installed in
the C:\Ruby193 folder. Check the boxes "Install Tcl/Tk support" and "Add Ruby executables to your PATH." Then click Install >> Finish.
- Open a Command Prompt Window:
Windows Start, Type Run in the box at the bottom and double click on cmd.exe.
or
Windows Start >> All Programs >> Accessories >> Command Prompt
- Check Ruby Version. To check if Ruby has been installed and that the environment is correctly configured, enter this
command in the Command Prompt Window:
> ruby -v
You should obtain
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
- Install DevKit.
From the same download page as the ruby installer, download the Development Kit. Run the exe file and have the files extracted to C:\DevKit.
Start a command prompt and change the directory to the DevKit folder using the following:
> cd c:\DevKit
Then run the following commands to set up the DevKit:
> ruby dk.rb init
> ruby dk.rb install
With the last command, you should see output indicating that DevKit has been installed.
- Install Ruby on Rails. In a Command Prompt Window, enter
> gem update --system
> gem sources –a http://gemcutter.org
> gem install rails
- Check Rails Version. In the Command Prompt Window, enter:
> rails -v
You should obtain
Rails 3.2.7
- Download SQLite. From the site
www.sqlite.org/download.html, download these zip files
from the Precompiled Binaries for Windows section:
sqlite-shell-win32-x86-3071300.zip
and
sqlite-dll-win32-x86-3071300.zip
or
sqlite-dll-win32-x64-3071300.zip
depending on whether your operating system is 32-bit or 64-bit. The versions might be different.
- Install SQLite. Unzip the files you downloaded in the
previous step. Place the files sqlite3.def, sqlite3.dll, and sqlite3.exe in the folder
C:\Ruby193\bin.
- Check that SQLite is correctly installed:
> sqlite3 –version
- Bind Ruby to SQLite:
> gem install sqlite3-ruby
Mac Ruby and Rails Installation
Reference: "Agile Web Development with Rails, 4th Edition," Ruby, et.al.,
The Pragmatic Bookshelf.
- First, make sure you have Xcode 3 or later installed. You can download Xcode as a free app from the App Store
(http://itunes.apple.com/us/app/xcode/id448457090?mt=12).
Verify your installation with this command:
$ xcodebuild –version
- Install the Ruby Version Manager(RVM) as described on the RVM website
rvm.beginrescueend.com/rvm/install.
$ curl –s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
Follow the installation instructions. You will need to append RVM function setup instructions to your .bash.profile:
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
Exit your command window and open a new one. This will cause your bash profile to be reloaded.
- Install the Ruby interpreter. This step will take some time.
$ rvm install 1.9.3
When the previous step is completed, install rails 3.2.7:
$ rvm use 1.9.3
$ gem install rails --version 3.2.7
Verify that the installation was successful using this command:
$ rails -v
- The rvm use 1.9.3 statement must to be repeated each time you open a shell window. You can also choose to make
it the default Ruby interpreter for a new terminal session with the following command
$ rvm --default use ruby-1.9.3