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.
Why g4install?
- Multiple Geant4 versions at the same time. Every version installs into its own directory and is exposed as a module, so you can keep, for example, 11.4.2 and 11.4.1 side by side and switch between them with a single command — no changes to your global system paths.
- Dependencies handled for you. The installer builds the matching CLHEP and Xerces-C and downloads the Geant4 datasets automatically.
- One layout everywhere. The same module workflow works on Linux and macOS (Apple Silicon).
- Ready-made containers and tarballs. Skip the build entirely with the pre-built
container images (
amd64andarm64) or the relocatable binary tarballs.
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
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:
- Container images with Geant4 and ROOT for
amd64andarm64, in batch and (on most images) VNC/noVNC graphical mode. See the Use Geant4 page for the image list and run commands. - Relocatable binary tarballs for Linux and Apple Silicon, published on the g4install development release. Extract, run the bundled dataset installer, and source the generated environment file.
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.