Python MySQL installing wrongly on Mac OS X 10.6 i386

macos, mysql, python

Solution

It appears you have installed and are using a python.org python2.6. Because that installer is designed to work for a range of systems, to build extensions with that python on 10.6, you need to install the optional 10.4 SDK which is part of the Xcode package on the Snow Leopard installation DVD or machine restore DVD; the 10.4 SDK is not installed by default. That's what the message is trying to tell you.

Problem

When trying to install MySQL's python bindings, MySQLdb, I followed the instructions to build and install on my MacBook running Mac OS X 10.6 i386, and after entering the following line into the terminal: ``` user-152-3-158-79:MySQL-python-1.2.3c1 jianweigan$ sudo python setup.py build ``` I get the following errors: ``` running build running build_py creating build/lib.macosx-10.3-i386-2.6 copying _mysql_exceptions.py -> build/lib.macosx-10.3-i386-2.6 creating build/lib.macosx-10.3-i386-2.6/MySQLdb copying MySQLdb/__init__.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb copying MySQLdb/converters.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb copying MySQLdb/connections.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb copying MySQLdb/cursors.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb copying MySQLdb/times.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb creating build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/CR.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/ER.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants running build_ext building '_mysql' extension creating build/temp.macosx-10.3-i386-2.6 Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk Please check your Xcode installation ``` It looks like the setup.py build script is recognizing my OS as Mac OS X 10.3 instead of 10.6 so it tries to locate an older version of XCode which I don't have. Does anyone know how to get around this problem? Perhaps manually configuring the script to recognize my os as 10.6?

Original source