Linux

Install via your package manager

Many Linux distributions provide packages for GAP, usually named gap. For example:

  • Debian or Ubuntu: sudo apt-get install gap
  • Fedora: sudo dnf install gap
  • Arch Linux: sudo pacman -S gap

This is the easiest way to get GAP. Its downsides are that the packaged version may lag behind the latest GAP release (see Repology for the version each distribution ships), and that some distributions leave out some of the GAP packages bundled with the GAP distribution, or put them into separate packages.

Install from source

This takes more work, but gives you the latest GAP release with all its packages, and is the best supported option.

Step 1: Install prerequisites

You need a C and a C++ compiler and GNU make. We also recommend the development headers for GMP, GNU Readline and zlib. On Ubuntu or Debian, install all of these with

sudo apt-get install build-essential autoconf libgmp-dev \
                     libreadline-dev zlib1g-dev

On Fedora:

sudo dnf install gcc gcc-c++ make autoconf gmp-devel readline-devel zlib-devel

On Alpine:

sudo apk add build-base autoconf gmp-dev readline-dev zlib-dev

Several GAP packages have additional dependencies, listed in INSTALL.md. On Ubuntu or Debian, install most of them with

sudo apt-get install 4ti2 pari-gp singular libncurses-dev \
                     libcdd-dev libcurl4-openssl-dev libfplll-dev \
                     libmpc-dev libmpfi-dev libmpfr-dev libzmq3-dev

On Fedora:

sudo dnf install 4ti2-devel pari-gp Singular ncurses-devel \
                 cddlib-devel curl-devel fplll \
                 libmpc-devel mpfi-devel mpfr-devel zeromq-devel

Step 2: Download and unpack the sources

Download one of these archives; they differ only in their format.

gap-4.16.1.tar.gz 577 MB sha256: df7d116f03c426dac24bf7c76ea11416b29c5a48eac12f97811d80ec215f7f69
gap-4.16.1.zip 597 MB sha256: 3d8b74f78582a0ee879be4fbbe0b7fb8540eaebc87f45a1625b1bb3c6433c2af

Unpack the archive in the directory where GAP should reside, and change into the directory this creates:

tar -xf gap-4.16.1.tar.gz
cd gap-4.16.1

Step 3: Compile GAP

./configure
make

This produces an executable called gap in the current directory.

Step 4: Build the packages

A fully functional GAP installation needs not only the core system but also some of its packages, and several of those must be compiled as well:

cd pkg
../bin/BuildPackages.sh
cd ..

This builds most of the packages that require compilation. Some may fail, for example because a library they need is missing on your system; their names are recorded in pkg/log/fail.log. GAP works without them. To get such a package to work, consult the README file in its directory.

Step 5: Start GAP

Start GAP with

./gap

and test your installation.

To be able to start GAP by entering just gap from any directory, create a symbolic link to the executable in a directory listed in your PATH, for example:

sudo ln -s "$PWD/gap" /usr/local/bin/gap

Alternatives

Frank Lübeck offers a Linux binary distribution via remote synchronization with a reference installation which includes all packages and some optimisations.