Getting B2a and b to run

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
Geant4 Version: geant4-v11.2.1
_Operating System:_macpro. Ventura. 13.6.5
Compiler/Version: gcc version 14.0.3
_CMake Version:_cmake version 3.23.2

After recompiling and the correction from Ruixuan, I got example B1 to run however I have tried B2 but no luck.

I compiled B2 after copying to a new directory but. from the build ./exampleB2a doesn’t work.

AM I using correct syntax, please?
Thnaks

Assuming exampleB2a is present in the directory you execute ./exampleB2a in, then yes, that’s the correct syntax. What error are you seeing, exactly?

Thank you for your response.

I am in B2 directory, these are the errors that I kept getting:

MacBook-Pro:B2 $ ./exampleB2a

-bash: ./exampleB2a: No such file or directory

(base)MacBook-Pro:B2 $ cd B2_build/

(base) MacBook-Pro:B2_build $ ./exampleB2a

-bash: ./exampleB2a: No such file or directory

Surprised to see my name here … I think maybe you did not compile B2a or B2b correctly.

Although you can compile example B2a and B2b at one time, I suggest you compile them seperately.
For example, if you want to compile and run B2a (suppose the directory of your B2 example is B2):

cd B2/B2a
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${where you install Geant4} ..
make -j8

If compiled sucessfully, you can see exampleB2a under your current directory (i.e. B2/B2a/build). You can use

./exampleB2a

to run B2a interactively.

In addtion, it seems that you have activated conda environment. From my own experience, it is better to deactivate conda when using Geant4. Activation of conda is irrelavent to your current problem, but it may influence your running of Geant4 some time in the future.

Thank you so much for your response.

I tried the suggestions but got error:
MacBook-Pro:B2 $ cd B2a/
MacBook-Pro:B2a $ mkdir build
MacBook-Pro:B2a $ cd build
MacBook-Pro:build $ cmake -DCMAKE_INSTALL_PREFIX=/Users/geant4-v11.2.1/Install
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

CMake Error: The source directory “/Users/geant4-v11.2.1/work/B2/B2a/build” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Then. I did a sym-link but more errors

CMake Error: File /Users/geant4-v11.2.1/work/B2/B2a/build/exampleB2a.out does not exist.
CMake Error at CMakeLists.txt:55 (configure_file):
configure_file Problem configuring file

– Configuring incomplete, errors occurred!

Then I just ran it without the build directory in B2a but got another set of errors with make -j8
MacBook-Pro:B2a $ ls -l
total 200
-rw-r–r–@ 1 staff 2205 Apr 24 21:40 CMakeLists.txt
-rw-r–r–@ 1 staff 470 Apr 24 21:40 GNUmakefile
-rw-r–r–@ 1 staff 272 Apr 24 21:40 exampleB2.in
-rw-r–r–@ 1 staff 4319 Apr 24 21:40 exampleB2a.cc
-rw-r–r–@ 1 staff 57044 Apr 24 21:40 exampleB2a.out
-rw-r–r–@ 1 staff 1532 Apr 24 21:40 gui.mac
drwxr-xr-x@ 10 staff 320 Apr 24 21:40 include
-rw-r–r–@ 1 staff 339 Apr 24 21:40 init_vis.mac
-rw-r–r–@ 1 staff 920 Apr 24 21:40 run1.mac
-rw-r–r–@ 1 staff 168 Apr 24 21:40 run2.mac
drwxr-xr-x@ 10 staff 320 Apr 24 21:40 src
-rw-r–r–@ 1 staff 272 Apr 24 21:40 startup.mac
-rw-r–r–@ 1 staff 2255 Apr 24 21:40 vis.mac

Build files have been written to: /Users/geant4-v11.2.1/work/B2/B2a

MacBook-Pro:B2a$ make -j8

GNUmakefile:16: …/…/…/…/config/architecture.gmk: No such file or directory

GNUmakefile:18: …/…/…/…/config/binmake.gmk: No such file or directory

make: *** No rule to make target `…/…/…/…/config/binmake.gmk’. Stop.

The command invoking CMake should be (and as @RuixuanTian clearly documented):

cmake -DCMAKE_INSTALL_PREFIX=${where you install Geant4} ..

Note the .. at the end of the line. That means “the directory one level above this” in UNIX terms.