Doc.Installation.Docker.MacOS - JETSCAPE/JETSCAPE GitHub Wiki

Step 1: Install Docker:

  1. Install Docker Desktop for Mac: https://docs.docker.com/docker-for-mac/install/

  2. Open Docker, go to Preferences --> Advanced and

    • Set CPUs to max that your computer has (sysctl -n hw.ncpu),
    • Set memory to what you are willing to give Docker.

Step 2: Download JETSCAPE

The docker container will contain only the pre-requisite environment to build JETSCAPE, but will not actually contain JETSCAPE itself. Rather, we will create a directory on our own machine with the JETSCAPE code, and share this directory with the docker container. This will allow us to build and run JETSCAPE inside the docker container, but to easily edit macros and access the output files on our own machine.

  1. Make a directory on your machine (which will be shared with the docker container), and clone JETSCAPE into it.
mkdir ~/jetscape-docker
cd ~/jetscape-docker
git clone https://github.com/JETSCAPE/JETSCAPE.git

In what follows we assume such a directory at ~/jetscape-docker. You may decide to name your directory something else, but if so please be careful to substitute your directory name appropriately in the instructions below.

  1. Create and start a docker container that contains all of the JETSCAPE pre-reqs.
docker run -it -v ~/jetscape-docker:/home/jetscape-user --name myJetscape jetscape/base:stable

If using a computer with an ARM64 architecture, an alternate Docker image is provided with native support for ARM64. Note that this alternate Docker image does not currently include the Root and Heppy packages. You may choose to use this image by replacing the above jetscape/base:stable with jetscape/base:multi-arch.

docker run -it -v ~/jetscape-docker:/home/jetscape-user --name myJetscape jetscape/base:multi-arch

Step 3: Build JETSCAPE

From inside the docker container, we can now build JETSCAPE.

cd JETSCAPE
mkdir build
cd build
cmake ..
make -j4     # Builds using 4 cores; adapt as appropriate

Step 4: Run JETSCAPE

That's it! You are now inside the docker container, with JETSCAPE and all of its prerequisites installed. You can run JETSCAPE executables or re-compile code. Moreover, since we set up the jetscape-docker folder to be shared between your host and the docker container, you can do text-editing etc. on your host machine, and then immediately build JETSCAPE in the docker container. Output files are also immediately accessible on your host machine if desired.

To test that everything is working, run an example to generate some pp events:

cd JETSCAPE/build
./runJetscape ../config/publications_config/arXiv_1910.05481/jetscape_user_PP_1910.05481.xml

This should take a couple minutes to run, and will print out a variety of information to stdout. Once done, it will produce a HepMC file test_out.hepmc in the same directory -- success!