When you install couchdb on OSX using homebrew it doesn't set it up for running continuously. Whenever you launch it using
sudo couchdb -b and your Mac goes to sleep it will kill the process, even if you used nohup. To make it run as long as you don't shut down your computer, and launch whenever you start it up you have to run it as a "daemon". Here's how I did it.
- Locate the launch daemon file "org.apache.couchdb.plist" located in
/usr/local/Cellar/couchdb/1.2.0/Library/LaunchDaemonsor some similar place.
- Now edit the file. I used:
and change the contents of the XML <string> element immediately following the <UserName> element to "root" instead of "couchdb".
sudo nano org.apache.couchdb.plist
- Now copy the file to the right place:
- Finally use the launchctl command to load it:
(You can also unload it using the same command but with "unload" instead of "load".) I've modified the
sudo launchctl load /Library/LaunchDaemons/org.apache.couchdb.plist
hritserver-start.shscript so it no longer kills and relaunches couchdb. If you are using hritserver make sure you have an up-to-date copy of that.