You can follow steps below to install memcached in your Mac OS. For more info, check cheat sheet and use phpMemcachedAdmin browser GUI.


If you ever get such permission errors as shown below, grant correct permission by running command as show below again.

# Error:
Could not symlink lib/pkgconfig/libevent.pc
/usr/local/lib/pkgconfig is not writable.

# Command:
Mac:football inanzzz$ sudo chown inanzzz /usr/local/lib/pkgconfig

# Then try to link failed library with:
Mac:football inanzzz$ brew link libevent
Linking /usr/local/Cellar/libevent/2.0.22... 25 symlinks created


# Install main memcached api
Mac:football inanzzz$ brew install memcached

# List all memcached related packages: "php56-memcached" and "libmemcached"
Mac:football inanzzz$ brew search memcached

# Install one from the list which will automatically install "libmemcached" as well
Mac:football inanzzz$ brew install php56-memcached

# Run "brew search memcached" again, if "libmemcached" is not installed then install manually

PHP extension

# Enable memcached extension in php.ini (path below depends on your OS)
Mac:football inanzzz$ sudo nano /usr/local/php5/lib/php.ini
extension =


# Run memcached as a deamon and restart apache
Mac:football inanzzz$ memcached -d
Mac:football inanzzz$ sudo apachectl restart


See other posts in this blog that are related to memcached where you'll find more testing options.

# Connect to memcached
Mac:football inanzzz$ telnet 11211
Connected to localhost.
Escape character is '^]'.

# Terminate connection
Connection closed by foreign host.

# Check version
VERSION 1.4.24