There is no need to switch to Linux or Mac to run Geant4. Windows is perfectly fine to develop and run Geant4 applications. Watch this video to learn the pro’s and con’s of individual operating systems if you cannot decide.
Geant4 on Windows
Geant4 libraries can be obtained in different ways on Windows:
- The easiest and recommended way for an end user is to use the official Windows installer, the one with the ‘.exe’ suffix in the Binary releases section on https://geant4.web.cern.ch/download. Binary releases are just another name for pre-compiled libraries. They are provided for a specific Windows and Visual Studio version, and may not work for a different version of Windows or Visual Studio.
- The second is to compile the source code of Geant4 libraries. It is error-prone and time consuming, but gives you more flexibility. Not recommended for end users.
- The third is to use Docker Desktop to run Geant4 in a container. It is fast, but the user needs to learn how to use a Linux container.
- The fourth is to compile the source code of Geant4 libraries in WSL. It is only suitable for people who are familiar to Linux.
Install Pre-compiled Geant4 Libraries
You can easily install Geant4 libraries pre-compiled for you by the Geant4 collaboration. The process is very similar to a typical Windows program, that is, double click an installer and click next, next, …, finish. The tutorial below made in 2023 is still valid in 2025 with the following updates:
- The Windows batch script created to automatically install Geant4 datasets (near 3:30) is replaced by the ones introduced in this video.
- The description on setting the
PATH
environment variable is more thorough in an older version of this tutorial.
Compile Source Code of Geant4 Libraries
You can also choose to compile Geant4 libraries in your own Windows PC. In that case, you need to install Visual Studio with C++ workload and CMake before you get started.
UPDATES:
- The process of setting environment variables for Geant4 datasets mentioned near the end of the video is obsolete, the updated procedure is covered in this video.
- If you cannot find an updated release of GEARS as mentioned near the end of this video, please watch the video above to compile GEARS by yourself.
GEANT4_USE_OPENGL_WIN32
in the CMake window needs to be checked to visualize Geant4 detector models.
Visual Studio
Visual Studio is huge. If you want to save some disk space and download time, please follow this YouTube short.