You can use the lipo command to create a copy of the Python interpreter with i386 support only.
:; file /usr/bin/python2.7 /usr/bin/python2.7: Mach-O universal binary with 2 architectures /usr/bin/python2.7 (for architecture i386): Mach-O executable i386 /usr/bin/python2.7 (for architecture x86_64): Mach-O 64-bit executable x86_64 :; lipo -thin i386 -output python-i386 /usr/bin/python2.7 :; file python-i386 python-i386: Mach-O executable i386 :; ./python-i386 Python 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
Then arrange existing scripts to call python-i386 or (if they use the /usr/bin/env trick) rename it to python and put it in the directory located in PATH somewhere before /usr/bin .
Note that looking at platform.architecture() or even platform.machine() does not actually tell you if the current process is 32-bit or 64-bit. They always give me 64-bit answers. But when I look at Activity Monitor, I see that my split binary is not marked as "(64-bit)", while the other processes.
source share