Start memcached with launchd [Updated]
I let memcached automatically start with the OS X integrated launchd. Here is the XML I provided to start it with the following settings:
- Bound to localhost
- Runs as nobody
- Spawns only one thread (this can slow things down)
- Consume a maximum of 10MB memory (it will just throw old stuff out afterwards)
- It will start when you login
- It will send all output to /dev/null
Here is the updated script (I use macports now instead of fink just change the path to wherever your binary is). Just put the XML to ~/Library/LaunchAgents/memcached.plist and run launchctl load ~/Library/LaunchAgents/memcached.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>memcached</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/memcached</string>
<string>-l</string>
<string>127.0.0.1</string>
<string>-u</string>
<string>nobody</string>
<string>-t</string>
<string>1</string>
<string>-m</string>
<string>10</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>StandardErrorPath</key>
<string>/dev/null</string>
</dict>
</plist>