I admit it: I'm a Rails noob. 100%. Totally. As a result, this post may be useful to 0.000001% of all starting Rails developers out there.
A while ago*, I pre-purchased Agile Web Development With Rails and for some reason decided to try it out this morning. Of course, as the book says, "neither Snow Leopard nor Lion prepackage Ruby 1.9.3, you’ll need to download and build it yourself." Goody. And neither does Mountain Lion (10.8). I'm also quite used to living in a Windows world where you just install whatever you need.
After a bit of searching, here's what you need to do to get Rails up and running without worrying about Xcode.
- Install the Command Line Tools (115 Mb). You will need an Apple Developer Account.
- Open Terminal and run the following commands
- curl -L https://get.rvm.io | bash -s stable --ruby
- (Optionally) rvm current should display ruby-1.9.3-p194 (or later)
- gem install rails
Note: You can skip steps 2.2 and 2.3 if you replace step 2.1 with curl -L https://get.rvm.io | bash -s stable --rails; I was trying to mimic the instructions in the book a bit.
At this point you should be able to run rails -v and get a response (e.g. Rails 3.2.8).
*Pragprog.com claims I bought it March 18, 2011 (520 days ago). I think it's trying to make me feel bad.