Instruction for Installing PyROOT on Snow Leopard?

I have spent a few hours browsing the posts here about installing PyROOT on Mac OS X, and have tried various configurations without success. Is there a current recommended recipe to get PyROOT working with Python 2.6?

The only successful solution I have found is using the pre-built binary and launching python2.5. I would like to be able to get PyROOT working with python 2.6, however. Ideally, I would like to have it working with the Enthought python distribution, but even instructions for the default python in Snow Leopard would be helpful.

All attempts have led to one of these two errors when calling “import ROOT”:
"Fatal Python error: Interpreter not initialized (version mismatch?)"
or something about the architecture being incorrect.

I’m ready to wipe the slate clean and try again from the beginning, so I am open to suggestions about what the best plan of attack would be.


the error message you are describing usually stems from running the python executable with a different version of the python.dylib shared library.

For a setup I can propose you to get a Python installation from


and then you would need to build ROOT yourself (configure macosx64).

After that you need to setup your ROOT environment + variables




I’m not very experienced with compiling applications like this, so I’m not entirely sure what the important points are here. I haven’t been able to find any libpython.dylib in my existing Python installations. Is that something that should be present? What exactly does that shared library do?

As for installing the version of python from CERN:

What would I do with this? Is there a specific location on my Mac where I should be copying that folder? As far as I can tell, the existing python installations on my machine are in /Library/Frameworks/Python.framework/Versions/, which seems to be an entirely different structure than on Linux.

I have found the instructions on actually building ROOT to be quite straightforward, so I am thankful for that. To check, I would want to run the configure script like this, with no extra options?:
./configure macosx64

Many thanks for the help,


not sure what “Enthought python” is (SciPy?) or how it is installed, but the configure script needs to be told about it in order for it to pick that python up. First, make sure that the python binary you want to use is the one that appears when you do which python, when you run the configure script. From there, if needed as the configure script will ask the python binary for its installation path, you can further point the script to the Python.h and Python library locations using --with-python-incdir=… and --with-python-libdir=… .

The output of the configure script indicates which locations will be used when compiling.

Note that you do not need to re-build all of ROOT if the build doesn’t work out: just run ‘make clean-pyroot’ to clean out pyroot only, while leaving the rest of the build (which doesn’t depend on python) intact.


Yes, SciPy is sponsored by Enthought and Enthought puts together a python distribution that includes numpy and matplotlib. The real reason I want to get this working is so that I can have matplotlib and PyROOT working in the same python session so that I can try to interface ROOT with matplotlib.

I have tried to follow your suggestions, but when I try to ‘import ROOT’ in python, I get the “ImportError: No module named ROOT”. Here is the recipe I came up with:

cd ~/Downloads/
tar -xzf root_v5.26.00.source.tar.gz
cd root/
./configure macosx64 --with-python-incdir=/Library/Frameworks/Python.framework/Headers/ --with-python-libdir=/Library/Frameworks/Python.framework/Versions/Current/lib/

Then, in my .bashrc, I’ve included the following:
. ~/Downloads/root/bin/
export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/Current/

Does anything look fishy here?


you seem to be missing make clean-pyroot; make?

For certain the setup should also add $ROOTSYS/lib to PYTHONPATH as well for python to find Setting PYTHONHOME should be unnecessary if the path to the binary is added to PATH.



Your recommendations helped me get to a point where it found, but gave an error about “wrong architecture”. It turns our the Enthought python distribution gives a 32-bit version, so I had to recompile.

In the end, here was my recipe:
cd ~/Downloads
tar -xzf root_v5.26.00.source.tar.gz
cd root
./configure macosx --with-python-incdir=/Library/Frameworks/Python.framework/Headers/ --with-python-libdir=/Library/Frameworks/Python.framework/Versions/Current/lib/
make -j 3

And I have the following in my .bashrc:
. ~/Downloads/root/bin/

Thank you Wim for yor help!

Just to report one more problem I had:

With the above directions, I could call ‘import ROOT’ fine, but when I actually tried to call anything from root, I got the following error:
ROOT.gSystem.dlopen error: dlopen(/Users/jeff/Downloads/root/lib/, 9): Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Library/Frameworks/Python.framework/Versions/Current/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Load Error: Failed to load Dynamic link library /Users/jeff/Downloads/root/lib/

It looks like root tries to load a bunch of extra libraries in /Library/Frameworks/Python.framework/Versions/Current/lib that it can’t handle.

The solution was to modify the definition of $DYLD_LIBRARY_PATH to specify the exact file rather than the whole lib folder:
export DYLD_LIBRARY_PATH=/Users/jeff/Downloads/root/lib:/Library/Frameworks/Python.framework/Versions/Current/lib/libpython2.6.dylib

After following those instructions for building root on my macbook. I put the following my ~/.profile and it works!

export ROOTSYS=/Users/michaelanderson/Downloads/root export PATH=$ROOTSYS/bin:$PATH export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/Current/ export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH export DYLD_LIBRARY_PATH=$ROOTSYS/lib:/Library/Frameworks/Python.framework/Versions/Current/lib/libpython2.6.dylib