How to install Memcached Server on Mac OS

Filed Under: Memcached

Memcached is an open-source high performance distributed memory object caching system. It is one of the most widely used cache mechanism used by some of the biggest websites like and

It is also used by VBulletin software, for faster performance, that is one of the best software for Forums. It’s easy to install and there are so many client programs available on the Internet in different languages.

Read: Memcached Java Client

Install Memcached on Mac OS

Memcached is a memory based caching mechanism and build using C language. To install memcached server on Mac OS, we need C library. Here I am assuming that C library is already present in the system. If it’s not, then you can download C compiler and install it or install XCode that installs GCC compiler with it.

After that, you need to install the lib events library.

Steps are;

$ curl -OL

$ tar -xvf libevent-2.1.8-stable.tar.gz 

$ cd libevent-2.1.8-stable

$ ./configure --prefix=/usr/local

$ make

$ sudo make install

Once libevents is installed then you can install Memcached server.

Steps are;

$ curl -O

$ tar -xvf memcached-1.5.0.tar.gz 

$ cd memcached-1.5.0

$ ./configure --prefix=/usr/local

$ make

$ sudo make install

install memcached server on mac os and linux

Now Memcached server is installed in your system. If the libevent library is not installed, configure command will give the following error.

$ ./configure --prefix=/usr/local
checking for libevent directory... configure: error: libevent is required.  You can get it from

      If it's already installed, specify its path using --with-libevent=/dir/

pankaj:memcached-1.5.0 pankaj$ 

Memcached Server on Different Port

By default, memcached server runs on TCP port 11211 and listens on UDP port 11211 and you can run multiple instances of memcached server from one installation.

$memcached -d

Above command will start the Memcached server on TCP port 11211 and listens on UDP port 11211 as a daemon process.

$memcached -p 11111 -U 11111 -d

Above command will start the Memcached server on TCP port 11111 and listens on UDP port 11111 as a daemon process.

Test Memcached Server using Telnet

Next step is to use memcached telnet commands to test that it’s working fine.

In some of the Linux systems, you also need to add the libevent library location in the path.

If you get following error in starting memcached server:

./memcached: error while loading shared libraries: cannot open shared object file: No such file or directory

Then add following configuration in user profile (for example, .bash_profile or .profile)

$export LD_LIBRARY_PATH= /usr/local/lib

Or, provide it’s path using --with-libevent option in configure command.

I have used the above steps to install Memcached server on Mac OS. If you face any issues, let me know. I will try to resolve them.

Happy Caching…

Further Reading: Install Memcached on CentOS and PHP integration



  1. NDD says:

    Wow, smooth processes..

  2. Hithisisgaryfrommacmostnow says:

    is this How I install Memcached Server on Mac OS/Linux?

  3. N says:

    Do you know how to install memcache on mac with SASL support? can you please help?

  4. Akshay Lokur says:

    I was looking for only this information. Really helped.
    Thanks Pankaj 馃檪

Leave a Reply

Your email address will not be published. Required fields are marked *

Generic selectors
Exact matches only
Search in title
Search in content