export PATH="/usr/local/opt/imagemagick@7/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/imagemagick@7/lib"
export CPPFLAGS="-I/usr/local/opt/imagemagick@7/include"
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@7/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/libffi/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/libffi/include $CPPFLAGS"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH"
./autogen.sh
./configure --with-gnutls --without-pop --with-imagemagick --without-x --with-json --without-dbus --with-ns --with-tree-sitter --with-xml2 --with-modules
# make -C lisp autoloads-force
# need to remove old *.elc files from lisp/ if using _dirty_ git directory
make
make install
mv nextstep/Emacs.app ~/Applications/
https://www.emacswiki.org/emacs/EmacsForMacOS#toc23