Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save appleton/1486618 to your computer and use it in GitHub Desktop.
Save appleton/1486618 to your computer and use it in GitHub Desktop.

Revisions

  1. @dstrelau dstrelau revised this gist Dec 3, 2009. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions coding-rails-with-homebrew.mkdn
    Original file line number Diff line number Diff line change
    @@ -23,8 +23,8 @@ the time.
    $ curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local

    WARNING: This should not destroy anything already in /usr/local, but you may
    have to fix their permissions. In particular, MySQL is particular about being
    owned by `mysql:mysql`.
    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.
  2. @dstrelau dstrelau created this gist Dec 3, 2009.
    91 changes: 91 additions & 0 deletions coding-rails-with-homebrew.mkdn
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,91 @@
    Coding Rails with Homebrew
    ==========================

    Right now, this assumes you are using Snow Leopard.

    Install Homebrew
    ----------------

    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. Also, let's chown that directory so we don't have to use `sudo` all
    the time.

    $ sudo chown -R `whoami` /usr/local
    $ curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local

    WARNING: This should not destroy anything already in /usr/local, but you may
    have to fix their permissions. In particular, MySQL is particular 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

    Install RVM
    -----------

    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

    Install Rails
    -------------

    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

    Install MySQL
    -------------

    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.