# Compiling deal.ii and ASPECT on Mac (apple silicon)

**URL:** <https://community.geodynamics.org/t/compiling-deal-ii-and-aspect-on-mac-apple-silicon/4111>\
**Category:** ASPECT\
**Created:** [May 6, 2025, 9:02am UTC](https://community.geodynamics.org/t/compiling-deal-ii-and-aspect-on-mac-apple-silicon/4111 "2025-05-06T09:02:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxrudolph](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/maxrudolph/32/248_2.png) [@maxrudolph](https://community.geodynamics.org/u/maxrudolph)\
**Post date:** [May 6, 2025, 9:02am UTC](https://community.geodynamics.org/t/compiling-deal-ii-and-aspect-on-mac-apple-silicon/4111/1 "2025-05-06T09:02:51Z")

</div>

Someone asked about compilation of deal.ii and aspect on M-series apple hardware at the ASPECT splinter meeting at EGU. There are instructions [here](https://github.com/dealii/dealii/wiki/Apple-ARM-M1-OSX) using Homebrew, but I thought that it might be useful to others to have a recipe using Macports.

**Step 1 - install openmpi, gcc (for gfortran) and blas/lapack**  
Using macports, install:  
sudo port install openmpi-gcc  
sudo port install cmake  
sudo port install OpenBLAS +native  
sudo port install lapack numdiff

**Step 2 - set environment variables for OpenMPI. Note that we are using Apple’s clang and gfortran provided by macports.**

export CC=mpicc; export CXX=mpicxx; export FC=mpif77; export FF=mpif77; OMPI\_CC=/usr/bin/clang; export OMPI\_CXX=/usr/bin/clang++; export OMPI\_FC=gfortran-mp-14

**Step 3 - install candi and use it to install deal.ii**  
(download and unpack candi)  
cd candi

- Edit candi.cfg to enable native optimizations in candi.cfg
- Set the trilinos major version to 16
- Note: there is as of 5/5/2025 a bug in kokkos that produces compile errors on Mac. You need to manually select trilinos 16.1.0 and insert the checksum:
- 
  - VERSION=16-1-0;CHECKSUM=d58ba4bcbcde701ee3a3e2e7cc27b6ca  
Run candi:  
./candi.sh --prefix=[path to installation] --packages=“p4est sundials trilinos dealii” -j 8

**Step 4 - install aspect**  
git clone [git@github.com](mailto:git@github.com):geodynamics/aspect.git  
mkdir build  
cd build  
cmake -D DEAL\_II\_DIR=/path/to/dealii ..  
make -j 8

**Step 5 - Running aspect**  
Sometimes there are issues at runtime finding shared libraries. Aspect could not locate libgfortran. This was likely due to Macports putting libgfortran in a version-specific subdirectory. I resolved it by doing:  
export DYLD\_LIBRARY\_PATH=$DYLD\_LIBRARY\_PATH:/opt/local/lib/libgcc
