Installing Geant4 with g4install



g4install builds and manages Geant4 with versioned Environment Modules. One command installs a complete Geant4 — together with its matched CLHEP and Xerces-C dependencies and the physics datasets — and registers it as a module you load on demand. It targets the same platforms supported at Jefferson Lab: Ubuntu 26.04 - Ubuntu 24.04 - Fedora 44 - AlmaLinux 9.4 - Almalinux 10 - Debian 13 - Archlinux.

If Geant4 is already installed for you on the JLab CUE machines (ifarm) or through CVMFS, you do not need to build anything — see the Use Geant4 page instead.




Why g4install?




Install from source

Building requires a C++ compiler, CMake, Git, Z shell, Environment Modules, Qt 6, and the X11/OpenGL, expat and zlib development headers. The exact package-manager command for each supported OS is in the prerequisites appendix of the g4install README.

1. Install the prerequisites and clone the repository

Install the packages for your OS, then clone the repository and register its modulefiles. Here we install into $HOME/g4install; choose any absolute path you prefer.


git clone https://github.com/gemc/g4install.git "$HOME/g4install"
module use "$HOME/g4install/modules"
module avail geant4

Add the module use "$HOME/g4install/modules" line to your .zshrc or .bashrc so the modules are available in every new shell.


2. Build Geant4 11.4.2


module load sim_system
install_geant4 11.4.2

The build takes a while and needs several gigabytes of disk space. When it finishes, load the module and verify it:


module load geant4/11.4.2
geant4-config --version




Multiple versions side by side

Installed versions live in separate directories and never interfere with each other. Install another version the same way, then switch by naming the old and new modules explicitly:


install_geant4 11.4.1
module load geant4/11.4.1

# switch the active version in place
module switch geant4/11.4.1 geant4/11.4.2

Run module avail geant4 to list every installed version.




Skip the build: containers and tarballs

If you do not need to compile Geant4 yourself, two faster options are available:




Traditional Geant4 installation

To build Geant4 by hand with CMake, without the module layout, follow the official Geant4 Installation Guide.




Questions or Feedback?

If you have any questions or suggestions, please contact me at ungaro. For general Geant4 issues, please use the Geant4 Forum.