Installing memcached on Mac OS X Leopard
This is how I install and run memcached on my MacBook Pro. It also runs on boot. The script can be downloaded at http://www.joonworld.com/files/memcache_on_mac .
1. Get and install libevent
wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
tar xvzf libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable
autoconf
./configure --prefix=/usr
make
sudo make install
2. Get and install memcached from source
wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar xvzf memcached-1.2.6.tar.gz
cd memcached-1.2.6
autoconf
./configure --prefix=/usr
make
sudo make install
3. Set it up to run at boot. The plist file is on my server.
wget http://www.joonworld.com/files/com.danga.memcached.plist
sudo mv com.danga.memcached.plist /Library/LaunchDaemons/
sudo launchctl load /Library/LaunchDaemons/com.danga.memcached.plist
Here’s the content of the plist file. You can customize this by changing the parameters.
[sourcecode language="xml"]
Comments
2 Responses to “Installing memcached on Mac OS X Leopard”
The build went fine (though I ended up using curl -O instead of wget)
But the launchd call gave me a warning:
launchctl: Dubious ownership on file (skipping): /Library/LaunchDaemons/com.danga.memcached.plist
I think the right thing would be to
sudo chown root:wheel /Library/LaunchDaemons/com.danga.memcached.plist
But when looking for supporting documentation I found another problem: running memcached under launchd as a daemon (the -d argument to memcached) is officially a “bad thing” according to http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html#//apple_ref/doc/uid/TP40001762-BCIEDDBJ
You must not daemonize your process
I don’t have a solution to that yet. If I find a better way to set this up I’ll let you know. Hoping someone else has some ideas. I’m a developer, not an ops guy.
Sorry if my guesses at acceptable html tags turn out wrong…
I don’t have any problem daemonizing memcached since it’s on my development machine. As for the “official” statement, I have yet to experience any issues and it’s trivial to shut it down and remove.