I am Hack Sparrow
Captain of the Internets.

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

4 Responses to “Install Memcached on Mac OS X”

  1. Arpit says:

    Nice article, if i want to stop or restart the memcached, how to do that?
    I tried memcached restart and memcached stop, but these commands doesn’t worked.

  2. Ryan says:

    Installing from Github now requires an additional step:



  3. anderson says:

    memcached -d worked well for me! Thank you! 😀
    I had installed MemCached already but it wasn’t working… i had to start it on my terminal.

  4. Kostyantyn says:

    Was able to install memcached on Mac. Many thanks!.
    However you missed one line after downloading memcached as a tar file:
    tar zxvf memcached-1.4.13.tar.gz

Make a Comment