Sage
Main repository of SageMath
Install / Use
/learn @sagemath/SageREADME
Sage is open source mathematical software released under the GNU General Public Licence GPLv2+, and includes packages that have compatible software licenses. People all around the globe have contributed to the development of Sage. Full documentation is available online.
Table of Contents
- Getting Started
- Supported Platforms
- [Windows] Preparing the Platform
- [macOS] Preparing the Platform
- Instructions to Build from Source
- SageMath Docker Images
- Troubleshooting
- Contributing to Sage
- Directory Layout
- Build System
- Relocation
- Redistribution
- Build System
- Changes to Included Software
Getting Started
Those who are impatient may use prebuilt Sage available online from any of
without local installation. Otherwise read on.
The Sage Installation Guide provides a decision tree that guides you to the type of installation that will work best for you. This includes building from source, obtaining Sage from a package manager, using a container image, or using Sage in the cloud.
This README contains self-contained instructions for building Sage from source. This requires you to clone the git repository (as described in this README) or download the sources in the form of a tarball.
If you have questions or encounter problems, please do not hesitate to email the sage-support mailing list or ask on the Ask Sage questions and answers site.
Supported Platforms
Sage attempts to support all major Linux distributions, recent versions of macOS, and Windows (using Windows Subsystem for Linux or virtualization).
Detailed information on supported platforms for a specific version of Sage can be found in the section Availability and installation help of the release tour for this version.
We highly appreciate contributions to Sage that fix portability bugs and help port Sage to new platforms; let us know at the sage-devel mailing list.
[Windows] Preparing the Platform
The preferred way to run Sage on Windows is using Windows Subsystem for Linux (WSL). Follow the official WSL setup guide to install Ubuntu (or another Linux distribution). Make sure you allocate WSL sufficient RAM; 5GB is known to work, while 2GB might be not enough for building Sage from source. Then all instructions for installation in Linux apply.
As an alternative, you can also run Linux on Windows using Docker (see below) or other virtualization solutions.
[macOS] Preparing the Platform
-
If your Mac uses the Apple Silicon (M1, M2, M3, M4; arm64) architecture and you set up your Mac by transferring files from an older Mac, make sure that the directory
/usr/localdoes not contain an old copy of Homebrew (or other software) for the x86_64 architecture that you may have copied over. Note that Homebrew for the M1 is installed in/opt/homebrew, not/usr/local. -
If you wish to use conda, please see the section on conda in the Sage Installation Manual for guidance.
-
Otherwise, we strongly recommend to use Homebrew ("the missing package manager for macOS") from https://brew.sh/, which provides the
gfortrancompiler and many libraries. -
Otherwise, if you do not wish to install Homebrew, you will need to install the latest version of Xcode Command Line Tools. Open a terminal window and run
xcode-select --install; then click "Install" in the pop-up window. If the Xcode Command Line Tools are already installed, you may want to check if they need to be updated by typingsoftwareupdate -l.
Instructions to Build from Source
Like many other software packages, Sage is built from source using
./configure, followed by make. However, we strongly recommend to
read the following step-by-step instructions for building Sage.
The instructions cover all of Linux, macOS, and WSL.
More details, providing a background for these instructions, can be found in the section Install from Source Code in the Installation Guide.
-
Decide on the source/build directory (
SAGE_ROOT):-
On personal computers, any subdirectory of your :envvar:
HOMEdirectory should do. -
For example, you could use
SAGE_ROOT=~/sage/sage, which we will use as the running example below. -
You need at least 10 GB of free disk space.
-
The full path to the source directory must contain no spaces.
-
After starting the build, you cannot move the source/build directory without breaking things.
-
You may want to avoid slow filesystems such as network file systems (NFS) and the like.
-
[macOS] macOS allows changing directories without using exact capitalization. Beware of this convenience when compiling for macOS. Ignoring exact capitalization when changing into :envvar:
SAGE_ROOTcan lead to build errors for dependencies requiring exact capitalization in path names.
-
-
Clone the sources with
git:-
To check that
gitis available, open a terminal and enter the following command at the shell prompt ($):$ git --version git version 2.42.0The exact version does not matter, but if this command gives an error, install
gitusing your package manager, using one of these commands:$ sudo pacman -S git # on Arch Linux $ sudo apt-get update && apt-get install git # on Debian/Ubuntu $ sudo yum install git # on Fedora/Redhat/CentOS $ sudo zypper install git # on openSUSE $ sudo xbps-install git # on Void Linux -
Create the directory where
SAGE_ROOTshould be established:$ mkdir -p ~/sage $ cd ~/sage -
Clone the Sage git repository:
$ git clone -c core.symlinks=true --filter blob:none \ --origin upstream --branch develop --tags \ https://github.com/sagemath/sage.gitThis command obtains the most recent development release. Replace
--branch developby--branch masterto select the most recent stable release instead.This will create the subdirectory
~/sage/sage. (See the section Setting up git and the following sections in the Sage Developer's Guide for more information.) -
Change into the created subdirectory:
$ cd sage -
[Windows] The Sage source tree contains symbolic links, and the build will not work if Windows line endings rather than UNIX line endings are used.
Therefore it is recommended (but not necessary) to use the WSL version of
git.
-
-
Install system packages.
Either refer for this to the section on installation from source in the Sage Installation Manual for compilations of system packages that you can install. When done, skip to step 7 (bootstrapping).
Alternatively, follow the more fine-grained approach below.
-
[Linux, WSL] Install the required minimal build prerequisites:
-
Compilers:
gcc,gfortran,g++(GCC versions from 8.4.0 to 13.x and recent versions of Clang (LLVM) are supported). See build/pkgs/gcc/SPKG.rst and build/pkgs/gfortran/SPKG.rst for a discussion of suitable compilers. -
Build tools: GNU
make, GNUm4,perl(includingExtUtils::MakeMaker),ranlib,git,tar,bc,patch,bzip2,pkgconf(also known aspkg-config). See build/pkgs/_prereq/SPKG.rst for more details. -
Python 3.4 or later, or Python 2.7, a full installation including
urllib; but ideally version 3.12.x or later, which will avoid having to build Sage's own copy of Python 3. See build/pkgs/python3/SPKG.rst for more details.
We have collected lists of system pac
-
Related Skills
node-connect
349.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.7kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
