Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Installing Sphinx Search Engine on Mac OS X... or ld: library not found for -lmysqlclient


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-
tar xzvf sphinx-
cd  sphinx-
./configure --with-mysql-libs=/opt/local/lib/mysql5/mysql/
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 w/ #development #environment #mac os x #sphinxprogramming