Jumpstart Lab Curriculum

Environment & Source Control

Environment Setup

Setting up your environment can be difficult when you’re first starting with Ruby. We want to get the following installed:

  • Git
  • Ruby 1.9.3
  • A text editor

The setup instructions are broken down by the following platforms: Mac; Linux; and Windows.

Mac OS

Mac OS is the most popular platform for Ruby and Rails developers. To have a properly setup dev machine you want the following:

OS X Mountain Lion

  • Install free XCode app from the Apple store. This app allows for the installation of the Comand Line Tools which are required for the successful installation of all ruby related content on Mac OS.
  • Once XCode app is installed, go to Preferences > Downloads > Install Comand Line Tools.

Other Mac OS versions

Command Line Tools for XCode

Register with the same Apple ID you use for other Apple services, such as iTunes, iCloud, and the Apple Online Store.

  • Login to the Apple Developer Portal.
  • Search for "Command Line Tools (OS X Lion) for Xcode" or "Command Line Tools (OS X Mountain Lion) for Xcode".
  • Download and install the package.

Homebrew

Homebrew is a package management system that makes it super easy to install hundreds of open source projects and compile them from source for maximum performance on your machine.

Terminal

$
 
 
 
 
 
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"==> This script will install:/usr/local/bin/brew/usr/local/Library/.../usr/local/share/man/man1/brew.1Press ENTER to continue or any other key to abort

Git

Git is the version control system of choice in the Ruby community.

Terminal

$
 
 
brew install git==> Downloading http://git-core.googlecode.com/files/git-1.8.1.1.tar.gz########################################################### 100.0%

RVM

RVM allows you to install and maintain multiple versions of Ruby. More information about Ruby Version Mananger (RVM) can be found at http://rvm.io

Terminal

$
$
bash -s stable < <(curl -L http://bit.ly/r52UYO)source ~/.bash_profile

Terminal

$
 
 
 
 
 
 
rvm install 1.9.3 --with-gcc=clangSearching for binary rubies, this might take some time.No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p374.Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.Installing Ruby from source to: /Users/burtlo/.rvm/rubies/ruby-1.9.3-p374, this may take a while depending on your cpu(s)...ruby-1.9.3-p374 - #downloading ruby-1.9.3-p374, this may take a while depending on your connection...######################################################################## 100.0%

Terminal

$
rvm use 1.9.3 --default

Text Editor

Linux

If Mac OS isn’t a possibility, then your next best bet is Linux. Among distributions, Ubuntu has the best support for Ruby and Rails development. You’ll need:

You want to avoid managing Ruby, RubyGems, etc. through your package management solution (apt). The packages available usually lag months behind the real source code repositories, and it is going to cause you massive headaches.

Instead, setup RVM and handle everything through there (as we’ll discuss in the next section).

If you’re going to be doing Rails work, then you should also install Node.js. You can get it from your distribution’s package manager. If you’re using Ubuntu, like above:

sudo apt-get install node

Text Editor

Windows

Getting started on the Windows platform is actually very easy. Engine Yard (http://engineyard.com) has put together the RailsInstaller (http://railsinstaller.org/), a single package installer with all the tools you need to get working. Make sure that, during the setup, you check the box to configure your environment variables. You can stop after step 2, once you’ve entered your email and name in the DOS prompt.

Beyond initial setup, though, there is going to be pain. As you add in more Gems and other dependencies you’ll find that many of them utilize native extensions, code written in C for better performance. Unless the authors have put energy into being cross-platform, you’ll run into issues.

If there is any way to avoid using Windows for your development environment, do it. For a free alternative, consider setting up a virtual machine with Virtual Box and Ubuntu Linux.

Text Editor

Feedback

Have Feedback?

Did you find an error? Something confusing? We'd love your help:

Thanks!