Wednesday, August 15, 2012

How to install Ruby and Rails on Mountain Lion as of now

Since XCode no longer packages gcc, you need to do some fancy dancing to get your rubies compiled.


Install XCode 4.4
Install XCode 4.4 from the App Store
Install XCode Command Line Tools (Open XCode, Preferences, Downloads)
sudo xcodebuild -license agree

If you skip that last step, you will see the following while attempting to install apple-gcc42
You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' 

Install Mac Ports
Download the Mountain Lion installer from http://www.macports.org/install.php/ and run it
sudo port selfupdate

Install GCC
sudo port install apple-gcc42
sudo port install gmake
sudo port install gpatch
sudo ln -s /opt/local/bin/gcc-apple-4.2 /opt/local/bin/gcc
sudo ln -s /opt/local/bin/gmake /opt/local/bin/make
sudo ln -s /opt/local/bin/gpatch /opt/local/bin/patch

Install RVM
curl -L https://get.rvm.io | bash -s stable --ruby
source ~/.rvm/scripts/rvm
rvm install 1.9.3-p194
rvm use 1.9.3-p194 --default

Happy Times!

2 comments:

  1. Thank you! I am new to both OSX and Ruby on Rails. After a few other failed tutorials, yours helped me get this installed.

    Thank you very much.

    ReplyDelete
  2. Another successful install of Ruby thanks to this post.

    ReplyDelete