CouchDB on Mac OS 10.5 via MacPorts
Firstly, this post assumes you know what CouchDB is. If you haven’t heard of CouchDB before, hop over to couchdb.apache.org to find out more about it.
There are 2 easy ways to get CouchDB running on Mac OS (excluding compiling from source):
CouchDBX
Download and run CouchDBX from Jan Lehnard’s blog. This includes everything you need to need to run CouchDB in one neat bundle – including the erlang runtime. At the moment it is Intel Leopard only.
MacPorts
MacPorts features both the CouchDB 0.8.1 stable release and the CouchDB 0.9.0a development release. Here is how you get it running:
$ sudo port [Users/deepak] > install couchdb
At this stage port will download and install a bunch of tools and dependencies required to build and run CouchDB. Once port finishes installing, exit to shell prompt again.
Now if things went well, you should be able to start CouchDB as:
$ sudo couchdb
Unfortunately, things didn’t quite work out for me. CouchDB logged the following output to the terminal but didn’t start:
Apache CouchDB 0.8.1-incubating (LogLevel=info) Apache CouchDB is starting. Config Info /opt/local/etc/couchdb/couch.ini: CurrentWorkingDir=/opt/local/var DbRootDir=/opt/local/var/lib/couchdb BindAddress="127.0.0.1" Port="5984" DocumentRoot=/opt/local/share/couchdb/www LogFile=/opt/local/var/log/couchdb/couch.log UtilDriverDir=/opt/local/lib/couchdb/erlang/lib/ couch-0.8.1-incubating/priv/lib DbUpdateNotificationProcesses= FullTextSearchQueryServer= javascript=/opt/local/bin/couchjs /opt/local/share/couchdb/server/ main.js
I finally tracked the problem down to the missing log folder which CouchDB was trying to access. So doing this:
$ cd /opt/local/var $ sudo mkdir log $ cd log $ sudo mkdir couchdb
Followed by attempting to start CouchDB again, did the trick:
$ sudo couchdb Apache CouchDB 0.8.1-incubating (LogLevel=info) Apache CouchDB is starting. Apache CouchDB has started. Time to relax.
You can check that all is well by issuing:
$ curl http://127.0.0.1:5984/
Which should return with the following output (or something similar to it):
{"couchdb":"Welcome","version":"0.8.1-incubating"}
You can also have control CouchDB with lauchctl (via):
sudo launchctl load /opt/local/Library/LaunchDaemons/org.apache.couchdb.plist sudo launchctl start org.apache.couchdb
