Pygame on OS X with python 2.5

Published on 2007-09-23 20:38:00+00:00
OS   Python   X  

I've used Pygame on Mac OS X in the past, but my installation recently stopped working for some reason, so I decided to grab the binaries and re-install. After checking out the Pythonmac list, I was a little disappointed to see that there were only Pygame binaries for Python 2.4. Below is a list of software that I installed (in the necessary order) to get pygame working with Python 2.5 on OS X. All of these (except Python 2.5.1) I got from

  1. Python 2.5.1 - from the Python download page.

  2. PIL 1.16 - Python Image Library.

  3. NumPy

  4. Numeric 24.2.

  5. numarray 1.5.2.

  6. PyObjC 1.4.

  7. wxPython (just in case)

Finally, I grabbed the Pygame 1.7.1 source from

Installation for most of the prerequisite packages went smoothly, since they all include OS X Installers. While pygame requires Numeric, I went ahead and installed NumPy and numarray, just in case.

The only real problem came when installing PyObjC. After installing, I opened a python interpreter to test it out by typing "import Foundation" (as it says to do in the PyObjC Tutorial. This let to the following error:

dyld: Symbol not found: __cg_jpeg_resync_to_restart  
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO  
Expected in: /sw/lib/libJPEG.dylib

Apparently, if you've installed anything using Fink, the PyObjC installer gets confused when trying to choose to which libraries to link. For me, libjpeg was the culprit... hence the error above. To make sure PyObjC works with Apple's ImageIO, I edited my ~/.profile and commented out any lines that set a DYLD_LIBRARY_PATH environment variable (just place a # in front of the line). For me, this looked like this:


This prevents any conflicts when linking against libraries installed by fink (which are stored in /sw) and possibly duplicate system libraries. After doing this, I re-ran the PyObjC installer, and everything worked perfectly. Now, I built the Pygame source, and my simple Pygame applications will run.

So what's next? Notice there's no mention of PyOpenGL above, so any Pygame applications that use PyOpenGL won't work Until you Install PyOpenGL

Download this Pygame Package: