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 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: 
Please check your Xcode installation

The solution is to download the psycopg2 source, then edit the - 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 install
should get it working.