Skip to content.


Personal tools
You are here: Home » Members » chrism's Home » Compiling Python 2.4 on A 32-Bit Mac with Snow Leopard

Compiling Python 2.4 on A 32-Bit Mac with Snow Leopard

Python 2.4 on a 32-bit Mac using Snow Leopard without a buildout.

Florian Schulze has created a buildout that compiles Python 2.4, 2.5, and 2.6 on Snow Leopard. By habit, I generally compile my Python interpreters "by hand" so I have a clue what's going on. I really just looked at Florian's buildout to see what it did and did that by hand.

Here's what I had to do to get Python 2.4 compiled on a fresh Snow Leopard install (not an upgrade) on a 32-bit Mac Book Pro (a Core Duo, not a Core 2 Duo; those have other issues).:

  • Install Fink
  • Install the readline5-dev library using "fink install" (for readline support in Python). If you don't compile against a "real" readline, Python will probably compile but it will probably buserror in an interactive shell or you'll not have any readline support in the interactive shell.
  • Download Python 2.4.6
  • Apply Florian's patch to the unpacked source of the Python 2.4.6 tarball. Note that things mostly sorta work without this patch, but (in particular) supervisor won't run without this patch (can't import the "resource" module and other POSIX-related things).
  • Use the following command to configure Python 2.4:
        CC="gcc -I/sw/include -L/sw/lib" ./configure MACOSX_DEPLOYMENT_TARGET=10.6 --disable-tk --prefix=$HOME/opt/Python-2.4.6
  • Use the following command to install Python 2.4:
        CC="gcc -I/sw/include -L/sw/lib" MACOSX_DEPLOYMENT_TARGET=10.6 make install
Created by chrism
Last modified 2009-09-05 05:17 PM

Problematic patch file

That patch file does not work for me against a newly downloaded Python 2.4.6 tarball:

$ patch -p0 <snowleopard.patch
patching file Include/pymactoolbox.h
patching file Include/pyport.h
patching file Mac/Modules/macosmodule.c
Hunk #1 FAILED at 40.
Hunk #2 FAILED at 54.
Hunk #3 FAILED at 68.
Hunk #4 FAILED at 82.
Hunk #5 FAILED at 110.
Hunk #6 FAILED at 127.
Hunk #7 FAILED at 172.
Hunk #8 FAILED at 181.
Hunk #9 succeeded at 273 with fuzz 1.
Hunk #10 FAILED at 285.
Hunk #11 FAILED at 351.
Hunk #12 FAILED at 458.
Hunk #13 succeeded at 482 with fuzz 1.
Hunk #14 FAILED at 503.
Hunk #15 FAILED at 538.
Hunk #16 succeeded at 559 with fuzz 2.
Hunk #17 FAILED at 620.
Hunk #18 FAILED at 660.
15 out of 18 hunks FAILED -- saving rejects to file Mac/Modules/macosmodule.c.rej
patching file Python/mactoolboxglue.c
patching file configure
Hunk #1 FAILED at 3907.
1 out of 1 hunk FAILED -- saving rejects to file configure.rej
patching file


On a 64-bit (with 32-bit EFI)

I managed to get Python 2.4 compiled using this configuration:

CC="gcc-4.2 -march=x86-64 -isystem /opt/local/include -L/opt/local/lib -L/opt/local/lib"

See (grep for "under-specify").