How To Install Ruby on Rails on Mac OS X

1) Install XCode from App Store

2) Install Command Line Tools from terminal

xcode-select --install

3) Install Homebrew

ruby -e "$(curl -fsSL"

And make sure everything is correctly configured

brew doctor

If you get an warning like this

Warning: A newer Command Line Tools release is available

Update them from Software Update in the App Store.

Warning: You have not agreed to the Xcode license.
Builds will fail! Agree to the license by opening or running:
xcodebuild -license

Install XCode Command Line Tools

Open XCode, agree the license, close and run again

brew doctor

4) Install RVM

\curl -sSL | bash -s stable
source ~/.rvm/scripts/rvm

Be sure "rvm is a function"

type rvm | head -n 1

5) Install RVM requirements

brew update
rvm requirements

If you get an error something like: No available formula for apple-gcc42 and cannot continue installing, run this code:

brew install autoconf automake libtool pkg-config apple-gcc42 libyaml readline libxml2 libxslt libksba openssl sqlite

rvm requirements

6) Make sure you install RVM:

rvm -v
rvm 1.24.4 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> []

7) Install Ruby

rvm get head
rvm install 2.0.0-p247

Make sure you installed Ruby

ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]

8) Use final version

rvm use 2.0.0-p247 --default

9) Install RubyGems

rvm rubygems current

10) Install Rails

gem install rails

Make sure you installed Rails

rails -v
Rails 4.0.0