Postinstall Setup

If you chose the default installation paths, then your install of Geant4 is completely contained under the directory passed to CMAKE_INSTALL_PREFIX, with hierarchy

+- CMAKE_INSTALL_PREFIX
   +- bin/
   |  +- geant4-config   (UNIX ONLY)
   |  +- geant4.csh      (UNIX ONLY)
   |  +- geant4.sh       (UNIX ONLY)
   |  +- G4global.dll    (WINDOWS ONLY)
   |  +- ...
   +- include/
   |  +- Geant4/
   |     +- G4global.hh
   |     +- ...
   +- lib{64}/
   |  +- libG4global.{so,a,dylib,lib}
   |  +- ...
   |  +- Geant4-10.5.0/
   |     +- Geant4Config.cmake
   |     +- ...
   |     +- {Linux,Darwin}-{g++,clang}  (UNIX ONLY)
   +- share
      +- Geant4-10.5.0
         +- examples/
         +- data/        (IF GEANT4_INSTALL_DATA WAS SET)
         +- geant4make/
            +- geant4make.csh
            +- geant4make.sh
            +- config/

Required Environment Settings on UNIX

If you wish to make the Geant4 Toolkit programs and libraries available via your PATH and library path (LD_LIBRARY_PATH on Linux) together with default environment variables for locating datasets, you should source the relevant script in CMAKE_INSTALL_PREFIX/bin. Please note that DYLD_LIBRARY_PATH is not set on macOS as this variable is not propagated to programs due to SIP. This should not affect general running of Geant4 applications as the default macOS settings link and install the libraries with suitable install names and RPATHs.

On interactive bourne shells (e.g. bash), do (assuming you are in CMAKE_INSTALL_PREFIX/bin):

$ . geant4.sh

This command can also be used to setup the environment for Geant4 in other Bourne shell scripts. You can also supply the full path to the script rather than changing to the directory containing it.

On interactive C shells, do (assuming you are in CMAKE_INSTALL_PREFIX/bin):

$ source geant4.csh

In an interactive session you can also supply the full path to the script rather than changing to the directory containing it. The C shell script cannot be sourced directly inside other shell scripts due to a limitation of the C shell which prevents the script being able to locate itself. If you need to source the C shell script inside another, then you can use the command:

$ cd CMAKE_INSTALL_PREFIX/bin ; source geant4.csh

where you should replace CMAKE_INSTALL_PREFIX/bin with the directory you installed geant4.csh in. You can also use the command:

$ source CMAKE_INSTALL_PREFIX/bin/geant4.csh CMAKE_INSTALL_PREFIX/bin

where as above you should replace CMAKE_INSTALL_PREFIX/bin with the directory where geant4.csh is located.

Required Environment Settings on Windows

On Windows, you should add the directory containing the Geant4 .dll files to your PATH/Path environment variable(s), and set the variables pointing to the datasets:

  1. On Windows 7
    • Open the Windows Control Panel.
    • Open the System item in the Control Panel.
  2. On Windows 10
    • In Search, search for and select System (Control Panel)
  3. Click the Advanced system settings link
  4. Click the Environment Variables button
  5. Select the PATH (or Path) entry in the User variables list, and click the Edit button. If PATH or Path are not present, click the New button and create one or the other.
  6. In the popup Edit User Variable window, add the directory in which the Geant4 dlls are installed to the Variable value entry of the PATH or Path variable (Note that on Windows, path entries are separated by semicolons). It’s very important to keep any existing entries otherwise other programs may stop working correctly!
  7. For each variable listed in Environment Variables for Datasets, create a new environment variable using the name and path listed there.
    • If you installed Geant4 with GEANT4_INSTALL_DATA set to ON, then the datasets will be present under CMAKE_INSTALL_PREFIX/share/Geant4-10.5.0/data.
    • Otherwise, set the paths to the locations you manually unpacked the datasets to.
  1. Click OK, and then OK through remaining windows to close.

Environment Variables for Datasets

If you need to manually manage the datasets for the Geant4 data-driven physics models, zip/tarballs can be downloaded from the Geant4 distribution site. Simply unpack these to a location of your choice and set each environment variable listed below to the full path to the unpacked directory for the given dataset. You can use any method you like to set these variables.

Environment Variable Value
G4ABLADATA absolute path to the G4ABLA3.1 directory
G4ENSDFSTATEDATA absolute path to the G4ENSDFSTATE2.2 directory
G4INCLDATA absolute path to the G4INCL1.0 directory
G4LEDATA absolute path to the G4EMLOW7.7 directory
G4LEVELGAMMADATA absolute path to the PhotonEvaporation5.3 directory
G4NEUTRONHPDATA absolute path to the G4NDL4.5 directory
G4PARTICLEXSDATA absolute path to the G4PARTICLEXS1.1 directory
G4PIIDATA absolute path to the G4PII1.3 directory
G4RADIOACTIVEDATA absolute path to the RadioactiveDecay5.3 directory
G4REALSURFACEDATA absolute path to the RealSurface2.1.1 directory
G4SAIDXSDATA absolute path to the G4SAIDDATA2.0 directory