Before it will install, you need to run the following from terminal:

sudo apt-get install libsasl2-dev

You can then install memcached normally via sudo gem install memcached