Building dtrace-enabled python from sources on Mac OS X

One highlight of Mac OS X Tiger is dtrace. Providers for ruby and python are also available, but only with the “system” interpreters (the one included out of the box). If you install python from, you can’t use dtrace anymore. Since the code to make dtrace enable python is available on the open source corner of Apple, I thought it would be easy to apply it to pristine sources available on

Unfortunately, for some strange reasons, Apple only provides changes in the form of ed scripts applied through a Makefile; the changes are not feature specific, you just have a bunch of files for each modified file: dtrace, Apple-specific changes are all put together. I managed to extract the dtrace part of this mess, so that I can apply only dtrace related changes. The goal is to have a python as close as possible to the official binary available on The patch can be found there.

How to use ?

  • Untar the python 2.5.2 tarball
  • Apply the patch
  • Regenerate the configure scripts by running autoconf
  • configure as usual, with the additional option –enable-dtrace  (the configuration is buggy, and will fail if you don’t enable dtrace, unfortunately)
  • build python (make, make install).
It time permits, I will post a .dmg. Needless to say, you run this at your own risk.

3 thoughts on “Building dtrace-enabled python from sources on Mac OS X

  1. It would be nice for sure, but I cannot take responsibility for this code; Apple are the one who should do this.

    To be included, it would have to be implemented by someone who knows about dtrace internals, and the patch would have to be cleaned up (it does not work when –enable-dtrace is not set up, for example).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s