Setting up Rails on a Mac
more from
apple
Jul 26, 07
I just got a new Mac and wanted to do two things: update Ruby, and install Rails. This post deliberately does not include any information about FastCGI, or Lighttpd, or any other customizations. This gets your Mac from "no rails" to "rails" quickly, and that's all. ;)
If you get stuck anywhere, check the following pages, as both of them are far more detailed than mine (and therefore take longer to dig through):
http://hivelogic.com/narrative/articles/ruby_rails_lighttpd_mysql_tiger?status=301
http://developer.apple.com/tools/rubyonrails.html
1. Update Ruby
Your Mac already has Ruby installed, but it's probably an older version (likely 1.8.2; run "/usr/bin/ruby -v" to check). To install the latest version of Ruby (which is currently 1.8.6), paste the following into a Terminal window:
cd /tmp; curl ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz -O; tar xzvf ruby-1.8.6.tar.gz; cd ruby-1.8.6; ./configure; make; sudo make install
You should now have Ruby 1.8.6 installed at /usr/local/bin/ruby, and you can verify with a quick test:
# ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]
2. Install "readline"
The most recent version is 5.2. To install it, paste the following into a Terminal window:
cd /tmp; curl ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz; tar xzvf readline-5.2.tar.gz -O; cd readline-5.2; ./configure --prefix=/usr/local; make; sudo make install
3. Install RubyGems
Get the latest version from here: http://rubygems.org
For example, I downloaded rubygems-0.9.4.tgz, moved it to /tmp, then did the following:
cd /tmp; tar xzvf rubygems-0.9.4.tgz; cd rubygems-0.9.4; sudo /usr/local/bin/ruby setup.rb
4. Install Ruby on Rails
Run this:
sudo gem install rails --include-dependencies
Verify that it worked:
/usr/local/bin/rails -v
Rails 1.2.3