As a follow-up to the previous entry on running Apache using the Mac OS X launchd service, here are the basic steps for daemonizing memcached, the distributed memory-sensitive cache.

  1. Start by installing libevent: ./configure, make, sudo make install
  2. Install memcached in the same way: ./configure, make, sudo make install
  3. Create a /Library/LaunchDaemons/com.danga.memcached.plist file with the contents shown below.
  4. sudo launchctl load /Library/LaunchDaemons/com.danga.memcached.plist

At this point memcached will be running, listening on the default port (11211). Below is a working plist file for memcached when installed using the default options.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">