How to install and run ecLand v2.0 on a Mac
This is a tested workflow on macOS (Intel/Apple Silicon) using Homebrew and OpenMPI to get all necessary packages and install / run ecLand v2.0. It avoids the common pitfalls you hit (dummy MPI, DR_HOOK crash, ifsbench issues). Note, this is a MacOS specific version of the notes available at https://github.com/ecmwf/ecland.
1. Install prerequisites (Homebrew)
Install homebrew Package Manager for macOS (or Linux
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install core dependencies using brew command :
brew update
brew install cmake open-mpi netcdf hdf5 eccodes pkg-config git wget python
2. Configure environment (critical step)
You must ensure ecLand sees MPI at build time.
# MPI paths
export MPI_HOME=$(brew --prefix open-mpi)
export PATH="$MPI_HOME/bin:$PATH"
# Force MPI compilers
export CC=mpicc
export CXX=mpicxx
export FC=mpifort
# Avoid DR_HOOK crash on macOS
export DR_HOOK_ASSERT_MPI_INITIALIZED=0👉 This step is essential — without it, ecLand will silently compile with dummy MPI and later crash with: "mpi_scatterv should never be called"
3. Get ecLand source
git clone https://github.com/ecmwf/ecland.git
cd ecland4. Clean build (important if retrying)
rm -rf build install5. Build ecLand
./ecland-bundle buildDuring configuration, check carefully that MPI is enabled:
✅ You want:
Found MPI_Fortran
Feature MPI enabled❌ If you see:
DUMMY_MPI_HEADER enabled
MPI was not enabled→ your environment is wrong (go back to step 2).
6. Run tests
cd build
ctest -R ecland --output-on-failureIf needed:
DR_HOOK_ASSERT_MPI_INITIALIZED=0 \
ctest -R ecland --rerun-failed --output-on-failure7. Fix ifsbench tests (first-time setup)
ecLand tests rely on a Python virtual environment.
Go to:
cd build/ecland/tests/ifsbenchCreate the environment:
python3 -m venv ifsbench_venv
source ifsbench_venv/bin/activate
pip install --upgrade pip
pip install .
deactivate👉 Important: install from the directory containing pyproject.toml:
/Users/.../ecland/tests/ifsbench8. Running a test manually
Example:
LAUNCH="ecland-launch -np 1 -nt 8" \
DR_HOOK_ASSERT_MPI_INITIALIZED=0 \
bash build/share/ecland/scripts/ecland_run_model.sh \
-s US-Ha1_1991-1996 \
-b build/bin/ecland-master \
-w build/ecland/tests/insitu_US-Ha1_1991-1996/work \
-o build/ecland/tests/insitu_US-Ha1_1991-1996/output \
-f build/ecland/tests/insitu_US-Ha1_1991-1991-1996/input \
-i build/ecland/tests/insitu_US-Ha1_1991-1996/input \
-F insitu \
-n tests/insitu_US-Ha1_1991-1996/namelist