HowTo: Install Sphinx along with MAMP / MAMP PRO on OS X Snow Leopard
The main problem to compile Sphinx on an OS X box is to find the appropriate libraries for MySQL. Fortunately MAMP may serve these in /Applications/MAMP/Library if prepared. This is a brief copy & paste howto.
Prepare your MAMP
You’ll need to have MAMP (or even MAMPPro) already installed. The main thing is to provide header and lib of the installed MySQL, so step-by-step:
Download the MAMP-Sources (eg. from http://sourceforge.net/projects/mamp/files/). After download the .zip-file should be extracted to your Downloads-Folder, so fire up your Terminal.app and go to….
$ cd ~/Downloads/MAMP_1.7.2_src
now unpack the mysql-sources and change to the mysql directory:
$ tar xvfz mysql-5.0.41.tar.gz $ cd mysql-5.0.41/
here you configure and compile the libs:
$ ./configure --with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock --without-server --prefix=/Applications/MAMP/Library $ make -j2
after finished compiling copy the libs to your MAMP directory:
$ cp libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql
and now continue with the header files:
$ mkdir /Applications/MAMP/Library/include $ cp -R include /Applications/MAMP/Library/include/mysql
Now Hands on Sphinx:
Download the sources and unpack them, ie:
cd ~ curl -O http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz tar -xzf sphinx-0.9.9.tar.gz cd sphinx-0.9.9
curl -O http://snowball.tartarus.org/dist/libstemmer_c.tgz tar -xzf libstemmer_c.tgz
Configure with MAMP MySQL library:
./configure --prefix=/usr/local --with-libstemmer --with-mysql=/Applications/MAMP/Library
Finally build and install, ie.:
make sudo make install
That’s it.




05/08/2010 at 19:15 Permalink
Thanks, this is just what I needed. (And very timely, too. I always think it’s crazy when I find the information I need in very recent blog posts. Makes me wonder what I would have done if I’d tried a few weeks earlier.)
06/08/2010 at 10:13 Permalink
yap, I made the same experiences googling and reading forums – thinking: “couldn’t I be the first to ask?”, that’s why I started contributing
20/04/2011 at 01:42 Permalink
hi. mysql now uses cmake… i’ve installed it with macports and run cmake (converting options as described at http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide). also run make and copied the include files to mamp but still got “cannot find MySQL include files” when configuring sphinx. ideas? thx
12/08/2011 at 19:43 Permalink
Hi bberg,
I don’t use macports any more as brew is a much better alternative… but anyway
Did you just install mysql or also the “mysql-dev” stuff? point here is, that sphinx just needs to include the appropriate libs and headers of your installed version of mysql.
If so just point there with the –with-mysql=/path/to/mysql-dev/lib/and/stuff switch.
try to find out with “locate libmysql”
22/02/2012 at 03:35 Permalink
Also, side note here, make sure to have XCode installed… This will cause issues when trying to run ./configure as your system will not be able to find a suitable C Compiler… This is also important because if you upgrade your system from Mac to OS X Lion, you will need XCode 4.x