Ruby on Rails

Ruby on Rails

I’ve been using Ruby on Rails for about five years now, and I can’t actually remember my life before it at this point.  As much as I love Ruby on Rails, I hate setting it up.  Okay, HATE is a pretty stiff word…let’s say “really, really, REALLY dislike”.

However, the last couple of times that I’ve had to configure machines, I’ve kept a really good running log of what I did, and I feel pretty confident that this little recipe will let me keep the rest of my hair.

Assuming you’re not an animal, and are indeed using a Mac, here’s our recommended configuration.

Before you start, here’s a few things you need:

Xcode Command Line Tools from Apple

You need the command line tools, they’re only a few hundred megabytes.  The whole Xcode package?  That’s several gigabytes.  If you are bandwidth capped, go to your local Apple store and download it there.

Home brew (because Curl, Wget, and MacPorts are for the homeless)

Homebrew is labelled as the installer that Apple forgot to include.  You can use other things, but they will make you sad about your life.


Can we be honest for a minute. Listen, it’s super cool that you’re using Terminal and not using GUI’s to do things like raking your gits and pulling your SQL’s, but let’s get serious here. Terminal is so 1994. The cool kids are all using Zshell. I know you don’t believe me, but you know what else you don’t believe? Laces are not cool man. In the future nobody wears laces.

Github Oh My ZSH

Rails Cast Getting Started With Oh My ZSH

Use a good theme for Zshell or you will be made fun of *

Edit your ~/.zshrc file and add this line:


At the bottom of this post I’m going to give you a few little Zshell tips you can add to be awesome.

Fix your damn Terminal Theme!

You also need the IR_Black terminal theme (your shirt is fine, but you need to take it to a tailor and get some “darts” sewn in. Listen, I don’t know what the eff a “dart” is either, other than they cost $12.00 to get!) IR Black Terminal Theme.

Database – My SQL

Don’t install it as a package. That’s not cool man. Instead, install it through HomeBrew Assuming you’re not an animal, you are running Mountain Lion, so follow these instructions.

The Simple Ruby Version Manager – Rbenv

An awesome way to run your rubies. The cool kids used to wear Dockers and use RVM.  Neither Dockers nor RVM are cool anymore though.

All of the cool kids use Rbenv, go get it!


ruby-build is an rbenv plugin that proivdes an rbenv install command. It is SO much cooler than you are, but you’re getting better. Hell, by the end of this tutorial, the cool kids may actually be able to take you out for a beer!

Install your Ruby
As of this note, we are using Ruby 1.9.3-p194

Yes, I am aware that the super-cool, cutting edge kids are using Ruby 2.0.0, you know what else the super-cool cutting edge kids are doing? DMT. Yeah, here’s the thing, you want to be able to have a conversation with the cool kids, but you don’t need to do EVERYTHING they are doing okay? It’s cool to still be you, when they offer you their DMT’s, you just say “Nah, thanks, but I’mma chill over here with my Red Bull and vodka.

Due to some fun with Clang, we have to do a couple of things first.

brew update
brew tap homebrew/dupes
brew install apple-gcc42

# this export must be done before every new ruby build
export CC=gcc
# use the version you wish to install
rbenv install 1.9.3-p194

I know what you want to do now. You want to just run your little Ruby on Rails server by going into the command line and typing in “Rails S” or some such nonsense don’t you?

NOT ON MY WATCH SON!!! Not on my watch.

Let me introduce you to Pow.

Pow is from 37 Signals (you may remember them from the time they…oh I don’t know…INVENTED RAILS?!?), and it’s a zero configuration rack app for running rails apps.

Available at You need to do a couple of things to make POW awesome.

Edit ~/.powconfig and add: export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH Co to Applications > Utilities > Activity Monitor and restart POW

Final Steps Now that you’ve got MySQL, rbenv, and pow, there are a couple last things you need to do for your project.gem install bundler (bundler doesn’t automatically get installed)

rbenv rehash bundle install

Finally, to make your MySQL load at start:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

Load it right now with this command:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Now, go through and close out all of your terminal sessions, kill the process for POW, and twirl around three times just to be sure.

Sublime Text 2 The really super cool kids are all using Sublime Text

If you’re super super cool and you want to be able to use Sublime Text as a text editor from Terminal, add this symlink:

ln -s “/Applications/Sublime Text” /usr/local/bin/subl

ZOMYGOD! Make sure you change the tab size to “Indent using Spaces”, and to the size of 2.

If you did EVERYTHING exactly as I wrote, it probably still doesn’t work. What I want you to do now is copy exactly the error you are having into Google, trust in Google.

It will tell you some obscure thing you need to do. Post that in the comments here and I’ll update this listing with anything you fine people discover.

  • * This is a true story, I was once made fun of because my zShell environment had “The Complete Works of Shakespeare on every line.” The cool kids…they are merciless!
  • The judgement of the cool kids is subject to change at the drop of the hat by the cool kids, your shoes probably aren’t cool right now, you just don’t realize it.

A little bonus here, these are some of my settings for zshell.  First, since you have Sublime Text 2 installed, do this (in terminal):

subl .zshrc

Now, in your .zshrc file, you’re going to want to set your theme:


Plugins help make Zshell even better.  I like the git, bundler, brew, gem, osx, rails3, sublime text, and POW plugins.

plugins=(git bundler brew gem osx rails3 textmate pow)

Your path should read:

# Customize to your needs...
 export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11/bin
 export PATH="$HOME/.rbenv/bin:$PATH"
 eval "$(rbenv init -)"