GEANT4 installation - next-exp/nexus Wiki

To install GEANT4, get the latest distribution from the Geant4 page. Unpack the GEANT4 source package to a location of your choice, let's call it /path/to/geant4. Create now a different directory for the configuration and building of GEANT4 and move to it:

mkdir geant4-build

cd geant4-build

Now, configure the build with the following command:


where /path/to/geant4/install is the path to the installation directory and /path/to/geant4 is the path to the source directory. You may want to install GEANT4 in the source directory, in which case both paths are the same. The GEANT4_USE_OPENGL_X11 option enables us to use the interactive mode of nexus, while the GEANT4_INSTALL_DATA option downloads and installs the data files in the $G4INSTALL/share/Geant4-x.y.z/data folder. In case the download gets stuck, you can just remove the option and download the files by hand.

In some systems, it is possible that an external installation of Expat is missing and an error is issued during the configuration. In that case, simply turn off the use of external Expat library with the -DGEANT4_USE_SYSTEM_EXPAT=OFF option, and GEANT4 will be built with its internal one:

To run the build, simply execute make in the build directory:

make -jN

with N the number of available cores and, subsequently, you can install GEANT4 running:

make install