Monday, August 11, 2008

Edge Merb and DataMapper on Leopard

After doing this a few times, I decided I'd document my steps for getting edge Merb with DataMapper up and running on a Leopard box. Be forewarned: when working with edge Merb and DataMapper, be prepared to deal with things breaking, at least until Merb gets to 1.0.

First, install the gems that Merb depends on:

$ sudo gem install english erubis hpricot json_pure mime-types rack

Next, install Git. You can try installing Git from source if you want, but MacPorts worked fine for me.

$ sudo port install git-core

Once you have Git installed, head on over to Github to start cloning the various repositories you'll need. I suggest creating one directory where you keep all your Merb-related repositories - I keep mine in ~/dev/merb.

$ git clone git://github.com/sam/extlib.git
$ git clone git://github.com/wycats/merb-core.git
$ git clone git://github.com/wycats/merb-more.git
$ git clone git://github.com/wycats/merb-plugins.git

These are the four main repositories for Merb. As the names suggest, if you wanted to just do barebones Merb hacking, you could get by with just merb-core and skip merb-more and merb-plugins. But in my experience, you're going to want them eventually, so I advise just installing them now.

Now we'll install each gem:

$ cd extlib
$ sudo rake install
$ cd ../merb-core
$ sudo rake install
$ cd ../merb-more
$ sudo rake install
$ cd ../merb-plugins
$ sudo rake install
$ cd ..

Congratulations, you now have edge Merb installed!

Next, let's install edge DataMapper. First, install the addressable gem, a dependency of data_objects:

sudo gem install addressable

Next, change directories back into your top-level Merb directory, if you haven't already by following the instructions above, and clone the necessary repositories.

$ git clone git://github.com/sam/do.git
$ git clone git://github.com/sam/dm-core.git
$ git clone git://github.com/sam/dm-more.git

Now go ahead and install the DataMapper dependencies and gems (NOTE - I got an error related to the PostgresSQL install here, but I don't use it. It may affect you however.):

$ cd do
$ sudo rake install
$ cd ../dm-core
$ sudo rake install
$ cd ../dm-more
$ sudo rake install
$ cd ..

Excellent, now you're ready to create a Merb app on the edge!

1 comment:

Ajay Kapal said...

Hi, thanks for the tips. PostgreSQL does indeed work, it just needs to be installed, and the path to the binaries must be set in your $PATH variable.

By the way, I just used the OS X binaries available for PostgreSQL 8.3.3 from the postgres site.