Skip to content

M2 on M1

Mahrud Sayrafi edited this page Mar 2, 2023 · 12 revisions

Installing M2 on M1

The first thing to try is the standard brew install Macaulay2/tap/M2. If that fails, first try:

brew remove gfan
brew install --build-bottle gfan
brew install --build-bottle M2

If that succeeds, please comment here that this worked for you.

Bottling M2 for M1

GitHub does not support building bottles for arm64 architecture yet, so Macaulay2 bottles for M1 must be built by volunteers and uploaded manually. See Bottling M2 for a guide.

Building M2 bottle with --head

If you are having issues with slow brew builds from source or errors while generating the documentation, you can instead try building the upstream version of Macaulay2 with:

brew install macaulay2 --HEAD

then installing the package documentation files with:

brew install macaulay2-common

Building M2 from git repository

You can also use brew to build the dependencies when compiling Macaulay2 from source.

brew tap macaulay2/tap
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/}

git clone https://github.com/Macaulay2/M2.git
cmake -GNinja -S M2/M2 -B M2/M2/BUILD/build \
      -DBUILD_NATIVE=OFF \
      -DCMAKE_PREFIX_PATH=$paths \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr

cd M2/M2/BUILD/build
ninja

Possibly relevant issues: