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
An update as of March 3, 2009:
http://sumanthtechsavvy.blogspot.com/2009/03/memcache-installations-for-rails-app.html
From February 16, 2009:
http://www.joeloliveira.com/2009/02/16/installing-libmemcached-and-the-memcached-gem-on-leopard/
Post a Comment