Step 1: Download the "Command line tools for Xcode" here
https://developer.apple.com/downloads/index.action
Step 2: Install homebrew with this command
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contribu...
Step 3: gem install rails