Skip to content

Building M2 from source on macOS

Mahrud Sayrafi edited this page Jun 25, 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)

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

cd M2/BUILD/build
git clone https://github.com/Macaulay2/M2.git
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
../../configure --enable-download --enable-build-libraries="readline" CC=/usr/bin/gcc CXX=/usr/bin/g++
gmake IgnoreExampleErrors=false
Clone this wiki locally