The post I wrote four years ago on installing memcached on OS X Leopard is still popular today. Here are the updated steps for installing on OS X 10.7.3 Lion with extra steps on getting memcached working with MAMP or your native Apache2.

# memcached requires libevent
cd /tmp
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
tar -xvzf libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable*
./configure
make
sudo make install
 
# Compile memcached utility
cd /tmp
curl -O http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz
tar -xvzf memcached-1.4.13.tar.gz
cd memcached-1.4.13*
./configure
make 
sudo make install
 
# Create .bash_profile alias to start memcached as needed
alias m="memcached -d -m 24 -p 11211" 
 
# Compile and copy memcached.so module
# For the lazy, you can use my memcached.so file or continue: # curl -O http://readystate4.com/memcache.so
cd /tmp 
# download one and untar http://pecl.php.net/package/memcache
phpize
./configure --enable-memcache
make
make install
# If using MAMP
# cp modules/memcache.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
# emacs /Applications/MAMP/bin/php/php5.3.6/conf/php.ini # add line: extension=memcache.so
# If using Apache2
# sudo emacs /etc/php.ini # add line: extension=memcache.so