I. ============== Build GCC 13.2.0

1. Download and extract GCC

curl -L https://ftpmirror.gnu.org/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz | tar xf -

2. GCC 10 depends on a couple of other libraries (GSL, GMP, MPFR and ISL) that can be downloaded with:

cd gcc-13.2.0
contrib/download_prerequisites

3. Configure GCC

cd gcc-13.2.0 
mkdir build 
cd build

../configure --prefix=/Users/username/Documents/Programming/gcc-13.2.0 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --program-suffix=-13.2

This command (i) assigns the --prefix folder (can choose any location for which writing privileges are available) as a folder for the gcc build;  (ii) appends --program-suffux to al executables (e.g., gcc-13.2).

4. Build and install
make -j 8
make install-strip

5. Add path for gcc-13.2 compilers

export PATH=/Users/username/Documents/Programming/gcc-13.2.0:$PATH

(put this line into .bash_profile or .zshrc)

II. ============== Build Openmpi-5.0.2

1. Download openmpi-5.0.2  (https://www.open-mpi.org/software/ompi/)

2.  Configure build and install

./configure --prefix=/Users/username/Documents/Programming/openmpi-5.0.2 CC=gcc-13.2 CXX=g++-13.2 FC=gfortran-13.2 F77=gfortran-13.2 --enable-static --disable-dlopen

make -j8 all
make -j8 install 

3. Add path for openmpi compilers

export PATH=/Users/username/Documents/Programming/openmpi-5.0.2:$PATH

(put this line into .bash_profile or .zshrc)

III. ============== Build hdf5-1.14.3

1. Download hdf5-1.14.3 (https://portal.hdfgroup.org/downloads/)

./configure --prefix=/Users/username/Documents/Programming/hdf5-1.14.3/ CC=mpicc FC=mpifort CXX=mpicxx --enable-parallel --enable-fortran

make -j8 install

IV. ============== Follow standard instructions for COGENT/Chombo/Hypre build

For hypre use: 
./configure CC=mpicc CXX=mpicxx --enable-maxdim=5
make -j8 install

For Chombo make file use: Make.defs.local