Unless there is a strong reason to build SageMath 8.9,
I would advise to build SageMath 9.0 or even 9.1.rc4.
On macOS the absolute prerequisite is to install
Apple's Command Line Tools for Developers. Installing
the full Xcode can be done too but is not required.
One can additionally install Homebrew. Many packages
needed by Sage can then be installed precompiled via
Homebrew. This can decrease SageMath's build time by
a fair amount.
To install Homebrew follow the instructions at
Then after getting and extracting the SageMath sources,
change to the extracted SageMath directory, and run
$ make configure
$ CC=clang CXX=clang++ FC=gfortran \
OBJC=clang OBJCXX=clang++ \
./configure
The "./configure" output will end by recommending
some packages to install with Homebrew. Follow
these recommendations.
Samuel