I just setup memcached on a new/clean Mac OS environment without WAMP.

My favorite terminal.

First of all, I use original apache service comes with this Mac.

Edit the file: "sudo vim /etc/apache2/httpd.conf" and remove "#" of the line “#LoadModule php5_module libexec/apache2/libphp5.so”. Then restart apache by:

> sudo apachectl restart

Download MySQL from mysql.com. I download version "Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive" (mysql-5.5.28-osx10.6-x86_64.dmg). After unpack .dmg file, there're one readme document and three pkg for install.

I install Homebrew for easier ports management. http://mxcl.github.com/homebrew/
After install Homebrew, install 3 packages step-by-step:

> brew install libevent

> brew install memcached

You can check if memcached was installed correctly by:

> memcache -h 

Then go to install the 3rd package named libmemcached by:

> brew install libmemcached

XCode: Command Line Tools
Get in App Store, to search and install "XCode" for free. Go to Xcode Preferences, and find Download tab. Make sure you install "Command Line tools" at least.

PHP Externsion
Once you get the command line tools in XCode, you are able to run: (you may need to change the version numbers.)

> sudo pecl install memcached-2.1.0

After successfully installation, you should add "extension=memcached.so" to php.ini. Restart apache again.

> sudo apachectl restart 

Now, all set! Enjoy memcached on your Mac. :)


Post a Comment