Monday, December 13, 2010

Install MySQL and Sphinx on Mac OS X 10.6 64bit

This is at least the fourth time I've done this in the past 3 years and every time it's slightly different. My last install I managed to get running using the MySQL 64 bit dmg. Prior to that I had always used MacPorts to install MySQL. However since moving to a 64bit machine, the MacPorts install of MySQL did not play nice with the MySQL Ruby gem.

First things first, download MySQL. I downloaded mysql-5.1.53-osx10.6-x86_64.dmg. It's a 77M download and takes a few minutes depending on your download speed.

**Note this assumes you do not have any currently installed versions of MySQL.

Click on the installer and run the mysql-5.1.53-osx10.6-x86_64.pkg Accept all the defaults and install. If it was successful you should see the install directory in /usr/local

If you want MySQl to start automatically, also install the startup item by running the MySQLStartupItem.pkg that was also part of the dmg you just downloaded. You can verify it installed correctly by checking /etc/hostconfig to contain MYSQLCOM=-YES-

Startup MySQL (taken from the ReadMe.txt):
shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(ENTER YOUR PASSWORD, IF NECESSARY)
(PRESS CONTROL-Z)
shell> bg
(PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)

Once it's running, DO NOT FORGET TO SET THE ROOT PASSWORD!!
./bin/mysqladmin -u root password 'your password here'

Now for Sphinx ....


At this point, I did try and install Sphinx using MacPorts ... however it does not recognize the MySQL install and tries to install a MacPorts version of MySQL. So we will download v0.9.9 and compile it ourselves.

Once the source is downloaded, extract it and then open a terminal to the extracted contents.
I extracted mine to ~/Downloads/sphinx-0.9.9 So at the terminal I ran
cd ~/Downloads/sphinx-0.9.9

Then we need to configure sphinx by running
sudo ./configure --prefix=/usr/local/sphinx --with-mysql
(Without sudo, the script cannot access everything it needs to configure sphinx.) The --prefix option tells it where to install. The --with-mysql is a default option, but I like to ensure it compiles for MySQL explicitly.

If it was successful, you should see:
configuration done
------------------

You can now run 'make' to build Sphinx binaries,
and then run 'make install' to install them.

At which point you can run
sudo make
and then
sudo make install

You should now see in /usr/local a sphinx directory. And unless you saw any errors, you have now installed Sphinx. You can also run
which searchd
to verify it installed properly. If which returns nothing, something went wrong. Otherwise, happy indexing!!

1 comment:

  1. The Eight-Wheel Classic - TITIAN Arts
    The eight-wheel classic bicycle is available https://septcasino.com/review/merit-casino/ in six sizes. ford escape titanium The Bicycle Wheel is a classic bicycle made in USA, but there https://vannienailor4166blog.blogspot.com/ are three ventureberg.com/ variations in

    ReplyDelete