Install CouchDB on Mac OS X (without using DarwinPorts)

The CouchDB installation instructions recommend using DarwinPorts for its dependencies. There is also a pre-built binary. If for one reason or another you don’t want to do either of those, here’s how to do it ‘by hand’.

install gettext

(Assuming libxml is installed like this)

  ./configure \
    --with-libxml2-prefix=/usr/local/libxml2-2.7.0
  make
  sudo make install

install Locale::gettext

  sudo perl -MCPAN -e 'shell'
  cpan> install Locale::gettext

install help2man

  
  curl http://svn.macports.org/repository/macports/trunk/dports/textproc/help2man/files/patch-Makefile.in \
      > patch-Makefile.in
  patch -p0 < patch-Makefile.in
  ./configure
  make
  sudo make install

install ICU4C 4.x

  http://site.icu-project.org/
  cd source
  chmod +x runConfigureICU configure install-sh
  ./runConfigureICU MacOSX
  make
  sudo make install

install spidermonkey

(based on linux instructions, obsolete for 1.8.x and beyond)

  cd src
  make BUILD_OPT=1 -f Makefile.ref
  mkdir -p /usr/include/smjs/
  cp *.{h,tbl} /usr/include/smjs/
  cd Darwin_OPT.OBJ/
  cp *.h /usr/include/smjs/
  mkdir -p /usr/local/{bin,lib}/
  cp js /usr/local/bin/
  cp libjs.dylib /usr/local/lib/

install erlang

  ./configure
  make
  sudo make install

install latest CouchDB

(should also work with a downloaded source distribution)

  svn co http://svn.apache.org/repos/asf/couchdb/trunk
  cd trunk
  ./boostrap
  ./configure \
    --with-js-include=/usr/include/smjs \
    --with-js-lib=/usr/local/lib
  make
  sudo make install

Run CouchDB

  couchdb &
  open http://127.0.0.1:5984/_utils/browse/index.html