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-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

Related posts:

  1. Install Sphinx on Ubuntu
  2. How to Install Ferret, the Full Text Search Engine with Your Rails Application
  3. Installing Scala on Mac OS X Leopard
  4. Use a Cron Job to Automate Sphinx Index Refresh from Rails Rake Task
  5. Fixing MySQL for Rails 2.2 Development on Mac OS X
This entry was posted in Programming and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Xenos Barrett
    Posted June 26, 2010 at 6:28 pm | Permalink

    Hi. Is there a quick fix to this issue im having…
    it appears when i go to make install.

    xwgstealth:~ blackjinxed$ sudo make install
    Password:
    Making install in src
    if test -d ../.svn; then svn info .. –xml | perl svnxrev.pl; fi;
    make install-am
    test -z “/usr/local/bin” || /sphinx-0.9.9/config/install-sh -c -d “/usr/local/bin”
    /usr/bin/install -c ‘indexer’ ‘/usr/local/bin/indexer’
    /usr/bin/install -c ’searchd’ ‘/usr/local/bin/searchd’
    /usr/bin/install -c ’search’ ‘/usr/local/bin/search’
    /usr/bin/install -c ’spelldump’ ‘/usr/local/bin/spelldump’
    /usr/bin/install -c ‘indextool’ ‘/usr/local/bin/indextool’
    make[3]: Nothing to be done for `install-data-am’.
    Making install in test
    /bin/sh: line 0: cd: test: No such file or directory
    make: *** [install-recursive] Error 1

Post a Comment

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

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>