Today I was pretty annoyed by the installation of the Sphinx Search engine, so I decided to summarise the solution here.

What is Sphinx Search?
I search engine like Solr, that you usually populate to make later your searches on.

What was my original task?
I wanted to use the Thinking Sphinx Gem for Rails to use it in a potential ECommerce Project.

The Problem?
I started to install the Sphinx Search engine separately which required a direct build and compilation on a unix base and it was breaking.
Although several sources give some advice I was kind of lost in all the information that could potentially help me. The build was still breaking mainly for two reasons:

1. Missing needed Unix Libraries, I was able to find some infos here about it.
2. The incompatibility of my mysql or postgres installations.

The confusion reason?
Since I used only Solr before, it was confusing why sphinx needs previous database installations. Well the answer is: Sphinx is indexing the data directly from the database, not through some http posts like Solr does.

One of the first things I tried immediately is installing Sphinx with Homebrew but failed, because of conflicting mysql versions that were not installed with homebrew befor.
So finally I was able to solve it, by installing mysql with homebrew and then sphinx with homebrew.

Install mysql
brew install mysql

Setup Installed MySQL
unset TMPDIR
mysql_install_db –verbose –user=`whoami` –basedir=”$(brew –prefix mysql)” –datadir=/usr/local/var/mysql –tmpdir=/tmp

Test working MySQL

mysql -uroot
show databases;

Install Sphinx
brew install sphinx

Adjust and Index
cd /usr/local/Cellar/sphinx/0.9.9/etc/
cp sphinx.conf.dist sphinx.conf

Setup here your database name and user

vi sphinx.conf  
cd ../bin/
./indexer –all