ROOT installation on OS X
In particle physics, when it comes to data analysis, CERN's ROOT
often is the tool of choice. It is a big and powerful framework that can do a lot of magical things. In this post, I don't want to discuss its advantages or disadvantages but rather explain how I install it on Mac OS and why I do so.
There are always different ways to install ROOT
. Although you might almost always want to work with the latest production version, be warned that new releases sometimes break compatibility with older code. You will have to decide for yourself whether you want to install via MacPorts and get to work quickly or compile from source and be able to maintain multiple versions on your system.
The easy way: MacPorts
If you don't care about multiple versions and just want to get started, you can install ROOT
via MacPorts with the following command. This will, however, install ROOT
into your $PATH
which might have unwanted side-effects.
Additional features can be activated by adding +feature
to the above line. The possible features are
clang30 clang31 clang32 clang33 clang34 clang35
gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 gcc49
for manually choosing the compiler version,
python26 python27 python31 python32 python33 python34
for specifying a Python version,
ruby
for enabling support for Ruby,
mariadb
mysql mysql51 mysql55
odbc
postgresql90 postgresql92
sqlite3
for adding database support, and a myriad of other options e.g for GUI frameworks or the TMVA framework for multivariate analysis:
avahi cocoa debug fftw3 fitsio graphviz gsl ldap minuit2
opengl percona pythia qt_mac roofit ruby soversion ssl
tmva x11 xml xrootd
Installation from Source
The following instructions are tested on OS X 10.9 and 10.8 and are most likely to also work in 10.7. Installation on 10.6 might be different but why would you be using such an old operating system, anyway?
Prerequisites
You will have to install Apple's XCode and the XCode Command Line Tools. XQuartz, the Mac OS implementation of the X11 framework, is mandatory.
From source
A more comprehensive documentation can be found on the official website.
The following lines will install a basic version of ROOT 5.34.18
to /opt/ROOT/5.34.18
.
If you want to speed up the compilation, use make -jN
where N
should be 1.5 times the number of cores on your machine, e.g. make -j3
on my old dual-core MacBook Pro.
The configure
step is where you can introduce additional options e.g. enable advanced packages or define custom paths. A comprehensive list of options can be obtained by running
My personal configuration looks something like this:
The last to lines ensure that the MacPorts version of Python 2.7 is used. If you want to do the same, make sure Python 2.7 is the active version via
Set up
Once the installation is finished, you can set up ROOT
by running
Afterwards, typing
should start the interactive interpreter.
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.34/18 14 March 2014 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
ROOT 5.34/18 (v5-34-18@v5-34-18, Mar 14 2014, 16:29:50 on macosx64)
CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
You can exit by typing .q
.
Go to the corresponding issue on GitHub, in order to discuss this article.