How to install Memcached on Mac OS X#

There are two ways to install memcached on Mac OS X. One is the easy way, the other is the harder but more flexible way.

Installation using brew Package Manager#

Installing memcached using brew is the easy way, and it is just a matter of a single command.

$ brew install memcached

There you have memcached installed on your Mac!

Installation from Source#

Installation from source code is a little bit harder, but you have more flexibility.

Memcached is depended on libevent, so install it first. Get the latest stable libevent source from http://libevent.org.

$ cd /tmp
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
$ tar zxvf libevent-2.0.18-stable.tar.gz
$ cd libevent-2.0.18-stable
$ ./configure
$ make
$ sudo make install

Next install memcached. Get the latest stable memcached source from http://memcached.org.

$ cd /tmp
$ wget http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz
$ cd memcached-1.4.13
$ ./configure
$ make
$ sudo make install

Starting memcached#

Memcached listens on port 11211 by default, to change it, use the -p option.

$ memcached -p 8000

To run memcached as a daemon (background process), instead of sitting at your terminal, use the -d option.

$ memcached -d -p 8000