Skip to content

Memcached on Leopard

First, the easy part, installing memcached and libmemcached using MacPorts:

sudo port install memcached libmemcached

Now, for the memcached gem — not quite so easy for me on Mac OS 10.5 (Leopard):

sudo gem install memcached
Building native extensions. This could take a while…
ERROR: Error installing memcached:
ERROR: Failed to build gem native extension.

extconf.rb:21: shared library ‘libmemcached’ not found (RuntimeError)

Thanks to this thread I was able to figure out something that worked:

sudo bash
# This next command belongs all on one line
# And forgive my blog’s smart-quoting, it knows not what it does
LD_LIBRARY_PATH=/opt/local/lib INCLUDE_PATH=/opt/local/include ARCHFLAGS=”-arch i386″ gem install memcached
exit

If everything works right you should be able to:

irb
require ‘rubygems’
require ‘memcached’
# => true

I had to `sudo gem install echoe` before the above worked.

If you know a more elegant way, please let me know!

2 Comments

  1. An update as of March 3, 2009:
    http://sumanthtechsavvy.blogspot.com/2009/03/memcache-installations-for-rails-app.html

    Monday, March 9, 2009 at 12:19 pm | Permalink
  2. From February 16, 2009:
    http://www.joeloliveira.com/2009/02/16/installing-libmemcached-and-the-memcached-gem-on-leopard/

    Monday, March 9, 2009 at 12:28 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*