-
Notifications
You must be signed in to change notification settings - Fork 634
Setting up macOS Environment
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 GNU Fortran and OpenMPI using Homebrew:
In your command window type:
$ brew update
$ brew install gcc
$ brew install openmpi
Now check if mpirun
executable exist in your environment.
$ which mpirun
/opt/homebrew/Cellar/open-mpi/5.0.3/bin/mpirun
This should show where your open-mpi executables (mpifort
, mpicc
compiler wrappers, mpirun
, etc.) are located.
Also, make sure mpifort
points to gfortran
installed via Homebrew.
$ mpifort -v
Using built-in specs.
COLLECT_GCC=/opt/homebrew/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/13.2.0/bin/../libexec/gcc/aarch64-apple-darwin23/13/lto-wrapper
Target: aarch64-apple-darwin23
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-13 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 13.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin23 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Homebrew GCC 13.2.0)
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
(if using bash) or ~/.zprofile
(if using zsh) startup file:
# MPI Library:
export MPIDIST=/opt/homebrew/Cellar/open-mpi/5.0.5
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.