2.3. Installation on Mac OS X — Apache CouchDB 1.7 Documentation

# 2.3. Installation on Mac OS X

## 2.3.1. Installation using the Apache CouchDB native application

The easiest way to run CouchDB on Mac OS X is through the native Mac OS X application. Just follow the below instructions:

1. Download Apache CouchDB for Mac OS X. Old releases are available at archive.
2. Double click on the Zip file
3. Drag and drop the Apache CouchDB.app into Applications folder

That’s all, now CouchDB is installed on your Mac:

1. Run Apache CouchDB application
2. Open up Futon, the CouchDB admin interface
3. Time to Relax!

## 2.3.2. Installation with HomeBrew

You can install the build tools by running:

    open /Applications/Installers/Xcode\ Tools/XcodeTools.mpkg

You will need Homebrew installed to use the brew command. To install the other dependencies run next commands:

    brew install autoconf
    brew install autoconf-archive
    brew install automake
    brew install libtool
    brew install erlang
    brew install icu4c
    brew install spidermonkey
    brew install curl

You may want to link ICU so that CouchDB can find the header files automatically:

    brew link icu4c

The same is true for recent versions of Erlang:

    brew link erlang

Now it’s time to brew CouchDB:

    brew install couchdb

The above Erlang install will use the bottled (pre-compiled) version if you are: using /usr/local for homebrew, and on 10.6 or 10.7. If you’re not on one of these, homebrew will build from source, so consider doing:

    brew install erlang --no-docs

to trim down compilation time.

If you’re hacking on CouchDB, and we hope you will, you may try the current git-based master (head) branch, or the next development release using this `couchdb` recipe, using either `--head` or `--devel` options respectively. This will allow quick installation of the future release branch when it becomes active. If you’re not sure if you need this, then you probably don’t. In both cases we assume you are comfortable identifying bugs, and handling any potential upgrades between commits to the codebase.

    brew install [--devel|--head] couchdb

Note

OS X Lion might hang on the final brew. See the thread at https://github.com/mxcl/homebrew/issues/7024 it seems in most cases to be resolved by breaking out with `CTRL-C` and then repeating with `brew install -v couchdb`.

If you wish to have CouchDB run as a daemon then, set up the account, using the “User & Groups” preference pane:

- Create a standard user couchdb with home directory as /usr/local/var/lib/couchdb
- Create a group called couchdb and add yourself, the couchdb user, and any others you want to be able to edit config or db files directly to it. Use the advanced group options to ensure the internal name is also correctly called couchdb.

Some versions of Mac OS X ship a problematic OpenSSL library. If you’re experiencing troubles with CouchDB crashing intermittently with a segmentation fault or a bus error, you will need to install your own version of OpenSSL.

### Running as a Daemon

You can use the launchctl command to control the CouchDB daemon.

You can load the configuration by running:

    sudo launchctl load \
         /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist

You can stop the CouchDB daemon by running:

    sudo launchctl unload \
         /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist

You can start CouchDB by running:

    sudo launchctl start org.apache.couchdb

You can restart CouchDB by running:

    sudo launchctl stop org.apache.couchdb

You can edit the launchd configuration by running:

    open /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist

To start the daemon on boot, copy the configuration file to:

    /Library/LaunchDaemons

Consult your system documentation for more information.

## 2.3.3. Installation from MacPorts

To install CouchDB using MacPorts you have 2 package choices:

- `couchdb` - the latest release version
- `couchdb-devel` - updated every few weeks with the latest from the master branch

    $ sudo port install couchdb

should be enough. MacPorts takes care of installing all necessary dependencies. If you have already installed some of the CouchDB dependencies via MacPorts, run this command to check and upgrade any outdated ones, after installing CouchDB:

    $ sudo port upgrade couchdb

This will upgrade dependencies recursively, if there are more recent versions available. If you want to run CouchDB as a service controlled by the OS, load the launchd configuration which comes with the project, with this command:

    $ sudo port load couchdb

and it should be up and accessible via Futon at http://127.0.0.1:5984/_utils. It should also be restarted automatically after reboot.

Updating the ports collection. The collection of port files has to be updated to reflect the latest versions of available packages. In order to do that run:

    $ sudo port selfupdate

to update the port tree, and then install just as explained.