Saturday, January 31, 2009

Installing Pygame on Leopard (OS X 10.5)

I was disappointed that the binary installers for Pygame available at expect that you have installed a version of Python from when Leopard (OS X 10.5) already comes with a perfectly good version of Python. I didn't want to install a whole separate version of Python just for Pygame.

So I decided to install Pygame from source. I followed the instructions on the "MacCompile" wiki at

Step 1:
I downloaded the latest versions of the SDL frameworks binaries for OS X (sometimes a bit more recent than the versions indicated on the above page):
SDL.framework 1.2.13
SDL_ttf.framework 2.0.9
SDL_mixer.framework 1.2.8
SDL_image.framework 1.2.7
and I copied the above framework folders from the DMGs to the /Library/Frameworks folder

Step 2:
I downloaded the source for the Numeric module (24.2) and then ran the command:
sudo python install
which installed some header files under /System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Numeric
and installed the Numeric module in /Library/Python/2.5/site-packages

Step 3:
I downloaded the combo installer for libpng & libjpeg from
and then renamed the libjpeg.dylib & libpng.dylib as recommended by the above instructions.

Step 4:
I downloaded the PyGame 1.8.1 source
and then (in the directory pygame-1.8.1release) ran the following command:
which gave the following output:

Using Darwin configuration...
Hunting dependencies...
Framework SDL found
Framework SDL_ttf found
Framework SDL_image found
Framework SDL_mixer found
Framework smpeg not found
PNG : found
JPEG : found
SCRAP : not found

Then I ran the following commands:
python build
sudo python install

As mentioned above, the Numeric module puts some header files into a "Numeric" sub-directory under /System/Library/Frameworks/Python.framework. That's not too bad, but I don't see why they couldn't have gone under /Library instead. The pygame stuff seems to have gone under /Library/Python/2.5/site-packages.

I tested the installation by running some of my Pygame programs - and it all seems to work fine.

1 comment:

  1. Thank you a million. After a wasted hour with missing instruction pieces and broken links you're a savior!