Written by Sean Behan on Sun Jun 17th 2012

If you are trying to install Sphinx on Mac OS X, it will most likely fail. The current version of MySQL bundled with Mac OS X is not supported and therefore, it will spit out the error message because it can't find the correct libraries.

 ld: library not found for -lmysqlclient

There is a quick solution to the problem -upgrade mysql! You'll need Mac Ports installed, available at http://macports.org/

Run the command

sudo port install mysql5
This will not destroy any existing data from your previous MySQL installation. The mac port installation will take a while, and it will appear as if it is just hanging. It's not. It just takes a while. I clocked it at 15 minutes on a relatively fast network connection. Drink a cappuccino!

After you have the upgrade you'll need to download Sphinx available at: http://sphinxsearch.com/downloads.html (latest stable) and build the Sphinx engine from source like so:

wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
tar xzvf sphinx-0.9.8.1.tar.gz
cd  sphinx-0.9.8.1/
./configure --with-mysql-libs=/opt/local/lib/mysql5/mysql/
--with-mysql-includes=/opt/local/include/mysql5/mysql/
make
sudo make install

Much thanks to this post b/c I spent forever trying to get the bundled version of MySQL linked properly: http://www.fozworks.com/2008/9/5/rake-installation-of-sphinx-in-mac-osx


Tagged with..
#development #environment #mac os x #sphinx #Programming

Just finishing up brewing up some fresh ground comments...