Filed under: postgres
Today, I’ve been trying to get PsycoPG2 installed on my Macbook so that I can run through some tests and try and improve the user experience on Who’s Playing and hopefully increase it’s usage. I re-installed OSX the other week, and there’s still some little things like this to catch.
First off, I tried installing it via Macports, which worked Ok, but didn’t install it in a directory that the default Apple install of Python could see, it put it in the Macports directory. After a while I couldn’t find any way to change the install dir, so I ran:
python_switch python25
which lost all my other libraries, and the Django framework. Not quite what I wanted really.
python_switch python-apple
Will switch you back to the Apple install.
The easiest thing to do is just to download the latest psycopg2 tarball, and edit the setup.cfg file. I also installed Postgres from the official Mac binary, not from Macports, so I told it to use pg_config from that install. Uncomment the pg_config line and point it to your install of Postgres.
pg_config=/Library/PostgreSQL/8.3/bin/pg_config
Then run setup.py
sudo python setup.py install
Job Done.
Update: For Snow Leopard users, you might also see the following error:
Symbol not found: _PQbackendPID
The solution, that I found on Kreegers blog, is to tell Snow Leopard that python needs to run in 32bit mode:
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
1 Comment so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Hi – so sorry for the delay in getting in contact. I was flagged up about your tweet regarding the UK Domino’s website. We did have a slight problem on Friday night – but can you give me some more details please? Can you drop me an email please?
Comment by Georgina Wald September 27, 2009 @ 7:56 amThanks. Georgina – Corporate Communications Manager.