My first Apple laptop was a PowerBook running the PowerPC G4 processor. The transition to Intel x86 chips provided many opportunities, but they lost their edge over time to become efficient heat generators. So far, I am very impressed by the ARM M2 processor and its 20 billion transistors. It does take some effort to get everything nicely configured. I am running macOS Ventura 13.1.
Awaken UNIX
Call me lazy, but I find the App Store convenient. It remembers that I have downloaded standard software such as Microsoft Office, Slack, and Xcode on some other machine, so it is a one-click installation for those. Not everything is there, but it does save time.
I also rely on homebrew for package management these days. Once I have Xcode installed, it is just a one line installation and one more to install a range of packages that I will use.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install gcc openmpi scalapack fftw qd openblas hdf5 cmake
zsh is the default UNIX shell.
Set up your zprofile, ssh config, and vimrc files to make working faster and more comfortable. My .zprofile
has some basic settings such as:
#stack size
ulimit -Ss unlimited
#general mac
alias ls='ls -G -ltr'
export TERM=xterm-color
alias cpu='echo time $(uptime) && echo $(sysctl -n hw.ncpu) cores on $(hostname)'
#c/fortran
export CC=gcc-12
export CXX=g++-12
export FC=gfortran
Later I will need C libraries that are in a non-standard location, so I find it useful to create the following link:
sudo mkdir /usr/local/include
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
It may be very specific to this moment, but I had an issue with gcc-12
and g++-12
not finding standard headers due to a mismatch with the Xcode version.
After spotting the source of the issue with cpp-12 -v
, there is a simple fix:
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
Python
I use conda as standard. This comes with the core python-related packages including jupyter-lab. It’s straightforward once you download the Apple Silicon (not x86) installation file. Then you are free to install all of your favourite packages, e.g.
pip install pymatgen ase phonopy smact matminer sumo shakenbreak dscribe
DFT: VASP
I use a range of density functional theory (DFT) packages, but VASP is a robust standard. Thanks to Alex for some of the tips used in getting this to work. Taking the shiny 6.3.2 version, I untared the source code, and:
cd vasp.6.3.2
cp ./arch/makefile.include.gnu_omp makefile.include
makefile.include
needs some tweaking, including:
-
Change all instances of
gcc
togcc-12
andg++
tog++-12
-
Add
-Dqd_emulate
toCPP_OPTIONS
and then modify the library links to point to the homebrew installation:
-
Set
SCALAPACK_ROOT ?= /opt/homebrew/
-
Set
OPENBLAS_ROOT ?= /opt/homebrew/Cellar/openblas/0.3.21
-
Set
FFTW_ROOT ?= /opt/homebrew/
To enable HDF5 support, uncomment that block of text and edit HDF5_ROOT ?= /opt/homebrew/
. I have copied my working makefile.include
over here.
make all
and wait a few minutes. Check the outcome by running mpirun -np 4 vasp_std
in the bin. You are treated to a warm hello characteristic of the vaspmaster.

DFT: FHI-AIMS
The all-electron DFT package FHI-AIMS uses cmake
for compilation setup, which has already been installed above via homebrew. Taking the latest version:
tar -xf fhi-aims.221103.tar.gz
cd fhi-aims.221103
mkdir build
cd build
cp ../initial_cache.example.cmake ./initial_cache.cmake
I edited initial_cache.cmake
to change mpif90
to gfortan
and cc
to gcc-12
, along with
set(LIB_PATHS "/opt/homebrew/lib/ /opt/homebrew/Cellar/openblas/0.3.21/lib/" CACHE STRING "" FORCE)
set(LIBS "lapack blas scalapack" CACHE STRING "" FORCE)
The edited file is over here. Then, simply:
cmake -C initial_cache.cmake ..
make -j 4
Check the outcome with mpirun -np 4 aims.221103.scalapack.mpi.x
. Happy computing.