Tony Landis home

Installing psycopg2 on OSX 10.5

Just a little tip if you get stuck installing the PostgreSQL Python database adaptor as I did. Here is the error I got when running setup.py install (I downloaded the source after easy_install failed to work):

building 'psycopg2._psycopg' extension
Compiling with an SDK that doesn't seem to exist: 
        /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation

The solution is to download the psycopg2 source, then edit the setup.py - around line 426 before after undef_macros[] add this:

,extra_link_args = ['-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib']

So that line will look like this:

undef_macros=[], extra_link_args=['-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib']))

That is all, running

$ sudo python setup.py install
should get it working.