Welcome to Sage Installation Guide

If you are reading this manual at https://doc.sagemath.org/, note that it was built at the time the most recent stable release of SageMath was made.

More up-to-date information and details regarding supported platforms may have become available afterwards and can be found in the section “Availability and installation help” of the release tour for each SageMath release.

Where would you like to run SageMath? Pick one of the following sections.

macOS

  • Do you want to do SageMath development?

    • Yes, development:

      Obtain the SageMath sources via git as described in The Sage Developer’s Guide.

    • No development:

      • Install the binary build of SageMath from the 3-manifolds project. It is a signed and notarized app, which works for macOS 10.12 and newer. It is completely self-contained and provides the standard Sage distribution together with many optional packages. Additional optional Python packages can be installed with the %pip magic command and will go into your ~/.sage directory.

      • Alternatively, install SageMath from the conda-forge project, as described in section Install from conda-forge.

      • Alternatively, build SageMath from source as described in section Install from Source Code.

Windows

  • Do you want to do SageMath development?

    • Yes, development:

      Enable Windows Subsystem for Linux (WSL) and install Ubuntu as follows.

      • Make sure that hardware-assisted virtualization is enabled in the EFI or BIOS of your system. If in doubt, refer to your system’s documentation for instructions on how to do this.

      • Run the WSL install command as administrator. This will install Ubuntu Linux.

        Note that the basic instructions in the linked article apply to up-to-date installations of Windows 10 and 11, but there are also links to the procedures for older builds of Windows 10.

      • If you had installed WSL previously or installed it using different instructions, verify that you are running WSL 2.

      • Set up your Linux username and password. Do not include any spaces in your username.

      • If your computer has less than 10GB of RAM, change the WSL settings to make at least 5GB of RAM available to WSL.

      Start Ubuntu from the Start menu. Then follow the instructions for development on Linux below.

    • No development:

      Enable Windows Subsystem for Linux (WSL) and install Ubuntu as follows.

      • Make sure that hardware-assisted virtualization is enabled in the EFI or BIOS of your system. If in doubt, refer to your system’s documentation for instructions on how to do this.

      • Run the WSL install command as administrator. This will install Ubuntu Linux.

        Note that the basic instructions in the linked article apply to up-to-date installations of Windows 10 and 11, but there are also links to the procedures for older builds of Windows 10.

      • If you had installed WSL previously or installed it using different instructions, verify that you are running WSL 2.

      • Set up your Linux username and password. Do not include any spaces in your username.

      • If your computer has less than 8GB of RAM, change the WSL settings to make at least 4GB of RAM available to WSL.

      Start Ubuntu from the Start menu, and type the following commands to install Sage from conda-forge. (The $ represents the command line prompt, don’t type it!) The second step will ask a few questions, and you may need to hit Enter to confirm or type yes and then hit Enter.

      $ curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
      $ bash Miniforge3-$(uname)-$(uname -m).sh
      $ conda create -n sage sage python=3.11
      

      (If there are any installation failures, please report them to the conda-forge maintainers by opening a GitHub Issue for conda-forge/sage-feedstock.)

      You can now start SageMath as follows:

      $ conda activate sage
      $ sage
      

      This way of starting Sage gives you the most basic way of using Sage in the terminal. See Launching SageMath for recommended next steps, in particular for setting up the Jupyter notebook, which is required if you want to use graphics.

Linux

  • Do you want to do SageMath development?

    • Yes, development:

      Obtain the SageMath sources via git as described in The Sage Developer’s Guide.

    • No development: Do you have root access (sudo)?

      • Yes, root access: Then the easiest way to install SageMath is through a Linux distribution that provides it as a package. Some Linux distributions have up-to-date versions of SageMath, see repology.org: sagemath for an overview. See Linux Package Managers for additional information.

        If you are on an older version of your distribution and a recent version of SageMath is only available on a newer version of the distribution, consider upgrading your distribution. In particular, do not install a version of Sage older than 9.5.

      • No root access, or on an older distribution: Install SageMath from the conda-forge project, as described in section Install from conda-forge.

      • Alternatively, build SageMath from source as described in section Install from Source Code.

In the cloud

More information:

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.