Specfem3D Cartesian Installation on Macbook M2

I am having the following error when trying to install Specfem3D Cartesian on MacOS M2 machine.

bash-3.2$ ./configure FC=gfortran CC=gcc MPIFC=mpif90 --with-mpi

checking for mpi.h… no

configure: error: MPI header not found; try setting MPI_INC.


I made it sure that all mpi libraries are installed.

bash-3.2$ mpi
mpic++ mpicc mpicxx mpiexec mpif77 mpif90 mpifort mpioutil mpirun

The error persists, and I’m seeking assistance to understand the reason behind it. Additionally, I am looking for any suggested solutions that would enable me to successfully install it on my machine.

mpi.h is often in a package called mpi-dev or openmpi-dev of mpich-dev or similar. You may want to check whether you have that installed. In fact, you should probably check first whether you really do have the mpi.h file or whether the error message is true: That there is no mpi.h file.