I’ve been trying to install Sphinx on on my Mac, and it is a challenge. Actually, sphinx it is installed… but it isn’t fully usable yet. To get it going, I had to:
Install MacPorts. Fairly easy.
Next, install the sphinx port.
I realized later that the instructions are the same on every page. This example isn’t true for sphinx.
% man sphinx
% apropos sphinx
% which sphinx
% locate sphinx
With sphinx, the commands you use are ./search ./searchd ./indexer ./spelldump. As far as I’ve found, you never run sphinx. I wish I knew this before. So I setup the config, the example config they package up that was at /opt/local/etc/sphinx/sphinx.conf.dist and this worked pretty well. I also had an example config from a friend, so that helped as well.
Indexing
Getting the indexing going wasn’t too had. After setting up the config, I just ran ./indexer index_name and it indexed the 2400 records in a second or two. By the time it started I think it was already done.
PHP API
Now, I just needed to set it up to work with php. Should be pretty easy, but I’m on a Mac. I thought I’d use the PECL package, so… after running locate pecl I found out where pecl was on the map, and ran pecl install sphinx.
It almost finished before I found out I was missing something. Apparently, when sphinx is installed through macports, it doesn’t install libsphinxclient.
ERROR: `/private/tmp/pear/cache/sphinx-1.0.0/configure --with-sphinx' failed
This is required for sphinx client. This is where I gave up, for now. I now have to install just this part of sphinx. But, I ran into another thing – a detail.
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
Really? Yep. When doing any of this without a main distro of linux, I run into problems. Though I’m sure I can get this working on the Mac, I like the comment at the end of this page:
Use –with-sphinx= or get a working OS.
My next step? Install XCode so I can have a c compiler…

No related posts.
No Comments