The Sinatra Songbook Project

Installing Sinatra

Installing Sinatra is relatively straighforward, but you have to have other programs installed first. This guide should help people install Sinatra from scratch.

I use Ubuntu as my main operating system, so please accept my apologies for anything that doesn’t work on OSX or Windows. Please add any comments if you spot anything I’ve missed.

You will need to get used to using a terminal command prompt when using Sinatra. This might be more familar to Linux and OSX users. Any code examples that start with $> mean “type this into a terminal prompt”. To open up a terminal in Ubuntu go to Applications menu -> Accessories -> Terminal. On Windows, the terminal can be launched through “Start->Programs->Accessories->Command Prompt”, or “Start->Run->cmd.exe”. On Mac OS X, the terminal is found in Applications/Utilities/Terminal. (Thanks to Lucas for helping out with the instructions for Windows and OSX).

Install Ruby

Sinatra and Sinatra applications are written in the Ruby programming language, so before you do anything, you need to install Ruby.

If you are using Linux or OSX, Ruby may already be installed (OSX should have it by default). Open up a terminal command line prompt and type:

$> ruby -v

This will either tell you which version of Ruby you have installed or complain about “ruby: command not found”, which means you don’t already have it.

On Ubuntu (or any Debian based Linux), open up a terminal and enter the following command:

$> sudo aptitude install ruby

You then need to add some symlinks to tell your system where Ruby is installed.

Install Ruby Gems

Ruby Gems are the standard way of packaging programs and libraries that are written in Ruby. Sinatra is a Ruby Gem as well as many of its extensions. You need to install the Ruby Gems program to be able to install or remove gems.

If you are using Windows, then Rubygems should have been installed along with the Ruby Installer for Windows.

If you are using Linux or OSX, go to http://rubygems.org/pages/download and download the latest version of Ruby Gems (currently it is 1.3.5).

If you are using a Debian-based Linux (such as Ubuntu), you might need to add two new libraries first, enter the following command into a terminal:

$> sudo aptitude install libyaml-ruby libzlib-ruby

Assuming you have downloaded to your home folder, open up a terminal and enter the following commands: