Compiling MySQL-Python on Mac OS X
Compiling is so 80s and not the Mac way
. If any system should have packages for everything it should be Mac! Well, before I drift off into why I think there should be packages for everything lets get back on topic.
I did this with Mac OS X 10.5 (Leopard) but it should work with older versions (and newer ones). If you tried them and they work please post up!
Developer Utils
If you haven't already, find your install disc of Mac OS X and poke through it and install Developer Tools. You can also download it from ADC (Apple Developer Connection) for free from here. You'll need to do that before continuing.
MySQL
Next you'll need to download the latest stable version of MySQL from here (version 5.0.45) as of this writting. Unpack it by double clicking it, install, blah blah blah.
MySQL-Python
Lastly, download the latest mysql-python from here (version 1.2.2 as of this writting). Unpack it by double clicking and open up _mysql.c in your favorite text editor as they usually say.
Find the following lines and delete them (line ~36):
#ifndef uint
#define uint unsigned int
#endif
Next find these following lines:
uint port = MYSQL_PORT;
uint client_flag = 0;
... and chane them to:
unsigned port = MYSQL_PORT;
unsigned client_flag = 0;
Some people reported having problems trying to build this because for some odd reason they are missing a `mysql` link in its lib directory to itself. Peek inside of /usr/loocal/mysql/lib and see if you have a symbolic link named `mysql` pointing to itself. If you don't, open up your Terminal and run the following command:
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
We're almost done
Open up your Terminal into the directory you unpacked mysql-python and run the following:
python setup.py build
sudo python setup.py install
Thats it! Enjoy!