Tuesday, August 23, 2011

Setting up ROOT and pyROOT on a new Mac

I just got a Mac and need to re-do the setup of my software stack. I'm keeping a log of anything tricky here, both for my own future reference and so others can use it as a reference. These instructions work for Lion and may work for other versions of OS X, but I haven't tested them.

Getting ROOT and pyROOT up and running:
Note: you can't use the pre-compiled ROOT because it's linked against the wrong version of python.
  1. Install Xcode from the Mac App Store. I got a few errors the first few times I tried to install it, but eventually it worked.
  2. Download and install the newest version of the enthought python distribution from http://www.enthought.com. If you hunt around, you can find a link to download it for free for academic use.
  3. Set up some environment variables. You can set ROOTSYS to the directory you want to install ROOT to.
    export PYTHONDIR=/Library/Frameworks/EPD64.framework/Versions/Current
    export ROOTSYS=/usr/local/root
    export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib/:$LD_LIBRARY_PATH
    export PATH=$ROOTSYS/bin:$PYTHONDIR/bin:$PATH
    export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
  4. Download the source for the newest production version of ROOT from http://root.cern.ch/drupal/content/downloading-root
  5. Unpack the tarball:
    tar -xf root_blah_blah.tar
  6. cd root
  7. Configure ROOT installation and compile
    ./configure macosx64 --enable-python --with-python-incdir=$PYTHONDIR/include --with-python-libdir=$PYTHONDIR/lib
    make
    sudo su
    export ROOTSYS=/usr/local/root
    make install
    exit
Now you should have working installs of both ROOT and pyROOT.

No comments:

Post a Comment