Right now, this assumes you are using Snow Leopard.
Homebrew is MacPorts (or APT) without the suck. http://github.com/mxcl/homebrew
First, you want to make sure you have the very latest version of XCode. The version on the DVD has bugs. Go download and install from
http://developer.apple.com/technology/xcode.html
Now you can grab homebrew. We'll install to /usr/local
because lots of things
look there by default. Homebrew will work from anywhere (eg, ~/homebrew
), but
other libraries (specifically RubyGems) may not be able to find the things it
installs. Grab the install script from http://gist.github.com/323731 and unzip it, then
$ cd ~/Downloads/gistSHA1-SOMEMASSIVEHASH # the filename will change over time
$ ruby install_homebrew.rb
WARNING: This should not destroy anything already in /usr/local, but you may
have to fix their permissions. In particular, MySQL is picky about being owned
by mysql:mysql
.
For good measure, let's install the latest version of git, just to make sure everything is working.
$ brew install git
...downloading/installing...
$ git --version
git version 1.6.5.3
Although Snow Leopard comes with Ruby 1.8.7 preinstalled, sooner or later you'll want to have multiple versions of Ruby on your machine. Let's just bite the bullet now and setup RVM (Ruby Version Manager) to handle this for us. If you're really convinced that the system Ruby is okay, you can skip this part.
RVM installs everything (itself, ruby, gems, etc) to ~/.rvm
and it comes with
a simple bootstrap script:
$ cd ~/src # or wherever
$ git clone git://github.com/wayneeseguin/rvm.git
$ cd rvm && ./install
Because Snow Leopard is all 64-bit, we need to tell RVM to be sure to build things as 64-bit:
$ echo 'rvm_archflags="-arch x86_64"' >> ~/.rvmrc
After starting a new Terminal window, you should now be able to run rvm
and
get the help text. Let's install the latest version of Ruby 1.8.7 and set it to
be the default:
$ rvm install 1.8.7
...downloading/installing...
$ rvm use 1.8.7 --default
Rails is a simple gem install. Note that because RVM keeps things inside
~/.rvm
, we don't have to use sudo
. We'll also grab the bundler gem, which we
will use later to unpack the gems we bundle within our applications.
$ gem install rails bundler
You could just run things on SQLite, but chances are that sooner or later you're going to find yourself writing some MySQL-specific code or facing an obscure bug where the production DB (MySQL) isn't behaving the same as your local DB (SQLite). Instead, let's just go ahead and install MySQL now.
$ brew install mysql
This one will take a while, so go get a coffee or something. Once it's finished, do like it says an run
$ mysql_install_db
$ launchctl load -w /usr/local/Cellar/mysql/5.1.41/com.mysql.mysqld.plist
You'll have to create user accounts and such if you want them. I assume you know how SQL works.