Ask Your Question

Cannot build sage from source on m1 Mac

asked 2022-07-05 23:34:10 +0100

cmann gravatar image

updated 2022-07-06 08:12:58 +0100

FrédéricC gravatar image


I am trying to build sage from the source code on my Mac with an M1 processor. I mention the M1 processor, because I was able to install on an older Intel based Mac without a problem.

Anyway, after downloading and extracting the 9.6 files into a directory, I ran the following commands:

./configure --enable-glucose

export MAKE="make -j6"


After a few minutes of it attempting to build things, it quit with the following messages. Let me know if you have any ideas how to get past this.

Error building Sage.

The following package(s) may have failed to build (not necessarily during this run of 'make all-start'):

  • package: gfortran-11.3.0 last build time: Jun 20 17:09 log file: /Users/cmann/sage/sage-9.6/logs/pkgs/gfortran-11.3.0.log build directory: /Users/cmann/sage/sage-9.6/local/var/tmp/sage/build/gfortran-11.3.0

  • package: gcc-11.3.0 last build time: Jul 5 14:02 log file: /Users/cmann/sage/sage-9.6/logs/pkgs/gcc-11.3.0.log build directory: /Users/cmann/sage/sage-9.6/local/var/tmp/sage/build/gcc-11.3.0

  • package: m4ri-20200115 last build time: Jul 5 14:05 log file: /Users/cmann/sage/sage-9.6/logs/pkgs/m4ri-20200115.log build directory: /Users/cmann/sage/sage-9.6/local/var/tmp/sage/build/m4ri-20200115

  • package: openblas-0.3.20 last build time: Jul 5 14:19 log file: /Users/cmann/sage/sage-9.6/logs/pkgs/openblas-0.3.20.log build directory: /Users/cmann/sage/sage-9.6/local/var/tmp/sage/build/openblas-0.3.20

It is safe to delete any log files and build directories, but they contain information that is helpful for debugging build problems. WARNING: If you now run 'make' again, the build directory of the same version of the package will, by default, be deleted. Set the environment variable SAGE_KEEP_BUILT_SPKGS=yes to prevent this.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2022-07-06 01:36:51 +0100

As noted on the page, Sage's version of gfortran will not build on the M1 chip. Please follow the directions there and in the Installation guide. In particular, this page gives instructions for building with homebrew or this page for instructions to use Conda.

edit flag offensive delete link more


Thanks for the reply. I'm pretty sure I followed those directions, but I still got those errors. I'll go back through it carefully and see if I didn't miss something. If it still doesn't work I'll come back.

cmann gravatar imagecmann ( 2022-07-07 23:05:59 +0100 )edit

If you follow the instructions and everything is working right, then Sage should rely on a version of gfortran (for example) installed by homebrew or conda, not build its own. With homebrew you also need to run source .homebrew-build-env before building to help Sage find the relevant components.

John Palmieri gravatar imageJohn Palmieri ( 2022-07-08 03:49:57 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-07-05 23:34:10 +0100

Seen: 182 times

Last updated: Jul 06 '22