Skip to content

Setting up macOS Environment

Chandan Paul edited this page Dec 11, 2024 · 10 revisions

In macOS we recommend using GNU fortran compiler with open-mpi. The latest release of Intel OneAPI doesn't support Apple chips anymore.

1. Installing Homebrew: Navigate to the Homebrew website and follow install instructions.

2. Installing Git and CMake using Homebrew: If your system doesn't have git and cmake, install them using following commands:

$ brew update
$ brew install git
$ brew install cmake

3. Installing GNU Fortran and OpenMPI using Homebrew:

In your command window type:

$ brew update
$ brew install gcc
$ brew install openmpi

Now check if mpirun and mpifort executable exist in your environment.

$ which mpirun
/opt/homebrew/bin/mpirun

$ mpifort -show
gfortran -I/opt/homebrew/Cellar/open-mpi/5.0.5/include -Wl,-flat_namespace -I/opt/homebrew/Cellar/open-mpi/5.0.5/lib -L/opt/homebrew/Cellar/open-mpi/5.0.5/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi

By default, mpirun and mpifort should be in your PATH variable after installation through homebrew. If not, you can explicitly add them to your environment by editing your ~/.bash_profile startup file:

# MPI Library:
export MPIDIST=/opt/homebrew/Cellar/open-mpi/5.0.5/bin/
export PATH=$MPIDIST/bin:$PATH
export LD_LIBRARY_PATH=$MPIDIST/lib:$LD_LIBRARY_PATH

Then log out and log in, or open a new terminal to check again output of above commands.

Clone this wiki locally