Geant4 on MacOS X

Geant4 compiles and runs on MacOS X 10.12. The following is how I did it.


Install gcc and cernlib following the instructions given in the GFORTRAN page and the CERNLIB page, if you haven't. In addition geant4 depends on CLHEP. Install it as

$ su
# apt-get update
# apt-get install clhep
# exit

If you just want to use precompiled binary packages, go directly to Installation subsection.

Geant4 Building Procedure

[1] Compilation Conditions

MacOS X Release 10.12
standard Mach Kernel (Darwin 16.3.0)
XQuartz's X11 (v.2.7.11) for MacOS X
[2] Compilation Procedure

First download all of the necessary source files from the GEANT4 site and my private patches: macosx10.11.patch, into a directory, <somewhere>.

$ ls <somewhere>

Then expand the source tarballs as follows in whatever directory you want to install GEANT4.

$ tar -zxvf <somewhere>/geant4.10.03.tar.gz
$ cd geant4.10.03
$ patch -p1 -s < <somewhere>/geant4.10.02-macosx10.11.patch
$ mkdir build
$ cd build
$ make
$ make install

[3] Test Run

Try exapmles in the "examples" directory.

Installation of Binary Packages


# apt-get update
# apt-get install geant4
# apt-get clean

# ln -s geant4.10.03 /opt/g4/pro

By default GEANT4 will be installed under /opt/g4. Use /opt/g4/pro/bin/ to setup environmental variables necessary to run GEANT4. /opt/g4/pro/bin/geant4-config will also come in handy

Dawn (A Visualization Tool for GEANT4)

# apt-get update
# apt-get install dawn
# apt-get clean

Dawncut (A Tool to Make a Cut View for GEANT4 Geometrical Objects)

# apt-get update
# apt-get install dawncut
# apt-get clean

David (A Geometry Debugger for GEANT4)

# apt-get update
# apt-get install david
# apt-get clean

Back to Keisuke Fujii's HEP on X Page Dec. 28, 2016