Skip to content

Building M2 from source on macOS

Mahrud Sayrafi edited this page Jun 27, 2024 · 4 revisions

You can reduce the compilation time by installing dependencies from Homebrew when compiling Macaulay2 from source. From the top directory of the git repository, run:

brew tap macaulay2/tap
brew install ccache
brew install $(brew deps --1 --include-build macaulay2/tap/M2)

cd M2/BUILD/build
deps=$(brew deps --1 --include-optional macaulay2/tap/M2 | tr '\n' ';')
paths=$HOMEBREW_PREFIX/opt/${deps//;/;$HOMEBREW_PREFIX/opt/}

cmake -GNinja -S ../.. -B . \
      -DBUILD_NATIVE=OFF \
      -DCMAKE_PREFIX_PATH=$paths \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr

ninja

Also see this Wiki.

From the top directory of the git repository, run:

brew install ccache ctags gnu-tar make wget yasm

cd M2
gmake get-libtool
gmake -f Makefile

cd BUILD/build
CC=/usr/bin/gcc CXX=/usr/bin/g++ ../../configure \
    --enable-download \
    --enable-build-libraries="readline"

gmake IgnoreExampleErrors=false
Clone this wiki locally