For some time, python.org OS X installers have been created with the requirement to provide one executable and shared Python library that will work on all recent OS X releases supporting PPC and Intel processors. A separate, but closely related requirement is that end users should be able to create and install Python packages with C or C ++ extension modules. Another goal is to make it easier to use tools like py2app to create and create full-fledged standalone OS X applications that can work out of the box on multiple OS releases. For various reasons, gcc-4.0 on OS X is currently one version that meets all of these requirements. But the choice of goals for deploying ABI, building architectures, and OS X SDKs are also important issues. Choosing a build environment that allows Python itself (traditional cPython) to be built on any supported platform also ensures that C extension modules can be built on any of these platforms.
About gory: gcc-4.0 remains the latest version of gcc introduced in the latest releases of developer tools for 10.4. 10.5 and 10.6 Developer Tools ship with both 4.0 and 4.2, but 4.0 is still the default for 10.5. Thus, gcc-4.0 is the common denominator for the last three releases of OS X. In addition to the gcc version itself, the question also arises as to why the ABI should be built, that is, which OS X causes the deployment target. As a rule, OS X makes some efforts to ensure backward compatibility by allowing older binaries to work on newer systems, although most of them are dynamically linked. To be able to create a Python interpreter that will run from 10.4 to 10.6, you must use gcc-4.0, set MACOSX_DEPLOYMENT_TARGET to 10.4 (the minimum OS X level required to run), use the appropriate SDK for 10.4 (this is somewhat confused called 10.4u . as in universal , and is an optional installation for 10.6 versions of Xcode Developer Tools), and install universal architectures on i386 and ppc , only two that are fully supported at runtime of all these systems.
The OS X installer modifies the cheat a bit and goes one step further: they actually set the deployment target to 10.3, which, as it turns out, leads to the creation of a binary file that will work with all versions of OS X, starting from 10.6 and ending with OS X 10.3. 9, the final release of 10.3, although not at the beginning of 10.3 releases. (Note that if you are still using 10.3.9, since gcc-4.0 is not part of the 10.3 developer tools, you may need manual intervention to create C extension modules, for example, overriding the gcc version, and you may encounter other problems. Python 10.3.9 gets minimal testing and exposure as part of the python.org release process these days, so the user beware.)
Gotchas : the most important thing should be clear from the above. When creating or installing packages using expansion modules, make sure that you are using a compatible version of GCC, architecture, deployment target, and SDK. Fortunately, if a package uses Python Distutils to build and install an extension module, it will usually take care of you automatically, since Distutils uses stored values based on the Python interpreter creation environment. This applies to the entire Python package that comes with the setup.py install script and applies to higher-level installation tools that use Distutils under covers, such as easy_install and pip .
An important exception: automatic configuration using Distutils GCC on gcc-4.0 - this was added after the release of 10.6, made it a problem, so it was not done in earlier versions 2.6 or 3.1 and not at all 2.5. If in doubt, you can always install and export it manually, as shown in your question.
Another common problem when creating or installing extension modules occurs when the module uses other third-party libraries or binaries. They must also be compatible. In particular, for 10.6, by default, the system should build, link, and execute as Intel-64 ( -arch x86_64 ), where possible. This can cause third-party libraries other than Python to not be statically or dynamically linked to the Python extension module because there is no compatible common architecture (since python.org Python only includes 32-bit i386 and ppc ). To get around this, you must be careful to create the right universal architecture when creating third-party libraries. How easy it is to do this, it varies greatly among different libraries. The plan is for the next release of Python 2.7 and Python 3.2 to include the second 32-bit / 64-bit version of the universal installation for Intel, built for 10.6 and higher, which will greatly facilitate life in 64-bit systems. (Note that for the initial release of version 2.7 there is a second 32-bit / 64-bit installer, except that it was built for 10.5 and higher and also includes 32-bit ppc. Unfortunately, this configuration is like It turned out to have a number of problems, including IDLE and Tkinter not working on 10.6. I will use it only with caution.)
For many popular Python packages with third-party library dependencies ( PIL and MySQLdb come to mind) there is another approach to minimizing compatibility issues and that it should use a complete solution (Python, Python, and third-party packages) from one of the third-party package distributors with open source code for OS X such as MacPorts, Homebrew, or Fink. There are some pitfalls started with each, but, in the long run, using them often can save you a lot of headaches.
Obviously, another attempt will try to create a package that depends on a new feature or bug fix not found in Apple gcc-4.0 releases. I do not know such packages, but maybe there are such. If so, this might be another good reason to solve another Python solution, such as creating and installing Python from MacPorts.