Friday, April 03, 2009

MySQL, OS X and easy_install MySQL-python...

I wonder, sometimes, if as developers we find excuses to hack at code. Part of today's chores had me installing MySQL, and the python DB connector, on my Mac Book Pro. It goes very quickly until I found myself today staring at this error:
$ sudo easy_install -Z MySQL-python
EnvironmentError: mysql_config not found
As always, I started by Googling to see who else had hit this problem. The first few hits were all unanimous, you had to edit the that ships with MySQL-python and change the path to match your OS X environment.

Yes, I'm sure that would work, but the isn't doing a "/go/to/this/bad/path/mysql_config ..." it's just doing "mysql_config ...".

In other words you can fix everything, and use easy_install by doing a simple:
$ PATH=/usr/local/mysql/bin:$PATH
(Make sure to adjust for the shell you're using!)
And then run the easy_install, everything goes fine.

Simple! MySQL 5.1.33 and MySQL-python 1.2.3 on OS X 10.5.