Tuesday, January 12, 2010

Install CouchDB with Homebrew with existing Erlang

If you're using excellent Homebrew to install fantastic unix CLI utilities on your OS X, then you might find this handy. I wanted to install CouchDB using Homebrew, but I quickly realized it depends on Erlang being built with Homebrew as well.. As I have built my own Erlang (and don't need another one) for my machine, I decided to look into the formula for CouchDB to see if I can tweak it to use Erlang that's already on my machine.

It turned out that the fix is very easy to apply. Only thing you need to do is to open the couchdb.rb file (in /usr/local/Library/Formula) and do the following:
  • remove the depends_on 'erlang' line

  • edit the call to the configure script so the line --with-erlang points to your erlang installation (mine is in /usr/local/lib/erlang).

Here's the patch:

10d9
< depends_on 'erlang'
16c15
< "--with-erlang=#{HOMEBREW_PREFIX}/lib/erlang/usr/include"
---
> "--with-erlang=/usr/local/lib/erlang/usr/include/"


Now do brew install couchdb and make something wonderful. Don't forget to let me know about it!