# GAP: a language and library for computational discrete algebra

> GAP is a system for computational discrete algebra with an emphasis on group theory, providing its own programming language, thousands of algebraic algorithms, and libraries of algebraic objects, distributed freely as source. This looks at how the system is built, how a development version differs from a release, and where it stops.

**gap-system/gap** — Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra

- Repository: https://github.com/gap-system/gap
- Website: https://www.gap-system.org
- Stars: 1,017 · Forks: 190
- Language: GAP
- License: GPL-2.0
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/gap-system-gap

## A language, an algorithm library and a data catalogue

GAP is a system for computational discrete algebra, with particular emphasis on computational group theory. It provides a programming language, a library of thousands of functions implementing algebraic algorithms written in the GAP language, and large data libraries of algebraic objects.

That triple is what makes GAP more than a calculator for permutations. A user writes GAP code, calls into a library of algorithms that someone else implemented, and works with the standard library of groups, representations and other algebraic objects that ships with the system. The algorithms are the accumulated work of a large research community, and the data libraries mean that a small group of finite groups or a specific family of algebras is available without the user having to construct it.

The stated users are research and teaching, for studying groups and their representations, rings, vector spaces, algebras, combinatorial structures and more. That is a fair description of how a computational algebra system is used, and it is also the reason the language is worth learning: it is not a general purpose language with a mathematics library bolted on.

The system, including source, is distributed freely, and the documentation points out that you can study it and easily modify or extend it for your special use. That is a deliberate statement of intent from a project that has been running for decades, and it shapes how the rest of the system is built.

## The kernel is C, the library and the data are GAP

The repository layout shows the architecture in the way a computational algebra system is normally layered.

The `src/` directory holds the interpreter kernel, and the `lib/` directory holds the GAP library, which is where the bulk of the algorithms live as GAP source. The `grp/` directory is the group data library, the catalogue of small groups and related objects that the library draws on. `extern/` holds bundled third party code, `cnf/` holds configuration, `tst/` holds the test suite, `doc/` the documentation sources, `dev/` developer tooling, and `benchmark/` the benchmarking harness. There is also a `hpcgap/` directory and a `README.hpcgap.md`, which is the parallel high performance computing variant.

The consequences of that split are practical. The library is readable, portable GAP code, so a function you do not understand can be read and stepped through. The kernel is C, which is where the raw speed lives for the operations that need it, and `libgap.pc.in` and the `.clang-format` file show that the C side is treated as a real code base with a style and a pkg-config file for embedding.

Two files in the root are worth knowing about. `GNUmakefile.in` and `Makefile.rules` hold the build system, and `README.buildsys.md` documents it, which is unusual and useful. `CHANGES.md` tracks the changes, and `CITATION` with `CITATION.in` is there because a system used in research needs a citation file.

## Cloning, autogen, configure, make

The documented path to a development version starts with git:

```bash
git clone https://github.com/gap-system/gap
```

A development build needs more software than a release build, because the release ships prebuilt dependencies. You need at least a C compiler such as GCC or Clang, a C++ compiler, GNU Make and GNU Autoconf. The documentation also recommends the development headers for GMP, the GNU Multiple Precision Arithmetic Library, for zlib, and for GNU Readline, and explains the consequence of skipping them: GAP will either build its own copies, slowing the compilation, or omit certain features.

On Ubuntu or Debian those are one command:

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

with equivalents given for Fedora with dnf, for Alpine with apk, and for macOS via Homebrew, Fink or MacPorts.

The build itself starts by generating the `configure` script:

```bash
./autogen.sh
```

after which you proceed as described in `INSTALL.md`, with a pointer to the GAP for macOS section of that file if you are on macOS. Once built, you start the system with:

```bash
./gap
```

The project is explicit that most users should use the official release from the install page instead, and the readme for the development version repeats that you can compile it if you really want to.

## GNU make, and a Makefile that refuses to build with the wrong one

The build system has one unusual property that is worth explaining, because it is the kind of detail that wastes an afternoon if you hit it unprepared.

The root `Makefile` exists to tell you what to do. Its first comment says it serves two purposes: if the user types make without having run configure, it suggests running configure, and the build system is written for GNU make and makes liberal use of its features. Therefore the real build file is named `GNUmakefile`, which GNU make picks up and other make versions ignore. The consequence is stated plainly in the file: if you have BSD make, it will run this `Makefile` instead, and the `Makefile` informs you that you need to use GNU make to compile GAP.

So the failure mode is a clear error message rather than a mysterious build failure, which is a good design choice. The default target simply delegates to that message and exits with status 1.

The rest of the build system is spread across `Makefile.rules` and `GNUmakefile.in`, and the notes on the build system live in `README.buildsys.md`. There is a `configure.ac` with `aclocal.m4`, so the configuration layer is the standard GNU Autotools, and `autogen.sh` regenerates it.

For a project of this age, the build system is also where the contributor instructions live: `CONTRIBUTING.md`, `DEVELOPING.md`, a `.gaplint.yml` for the GAP-specific linting, `.clang-format` for the C sources, and a CI workflow with a codecov badge for coverage.

## The package collection has to be bootstrapped separately

Here is the difference between the release and the development version that trips people up, and it is stated directly in the documentation.

In contrast to the GAP stable releases, the development version does not come bundled with all the GAP packages. If you do not have a GAP package archive yet, the recommendation is to bootstrap the stable versions of packages by running one of two commands:

```bash
make bootstrap-pkg-minimal
```

or

```bash
make bootstrap-pkg-full
```

The choice depends on your needs for development. There is a caveat on the full variant: `make bootstrap-pkg-full` only unpacks packages and does not build those of them that require compilation. For those you change to the `pkg` directory and call `../bin/BuildPackages.sh` from there to build as many packages as possible.

The reason for the split is the same as the reason for the extra build dependencies. A release bundles working, compiled packages so a user can run it; the development tree carries the core and the package machinery, and the packages are fetched or unpacked on demand.

Development versions of some of the GAP packages live in their own place, on the gap-packages GitHub organisation and on the corresponding GitHub Pages site, and the packages are versioned separately from the core system. For a user, the practical step is to run the bootstrap before the first `./gap`, otherwise the missing package archive will surface as a confusing runtime problem rather than an obvious setup step.

## Where GAP is the wrong tool

The limits are mostly about scope and about what you are signing up for to build it.

The first is that GAP is a specialised language. It is excellent for group theory and discrete algebra, and it is not a general purpose language, so a team whose real need is application programming with a library of group theory functions will find the language itself an obstacle. The alternative in that case is a general purpose language with a computational algebra package behind it, where the algorithms are called rather than read and modified.

The second is the build cost of the development version. A C compiler, a C++ compiler, GNU Make, GNU Autoconf and the GMP, zlib and Readline headers are the floor, and the documentation is candid that skipping the optional headers makes GAP build its own copies and slow down. On top of that, the package collection has to be bootstrapped, and the compiled packages have to be built separately.

The third is the licence. GAP is free software under the GNU General Public License, version 2 or, at your option, any later version, so redistribution of a modified GAP carries the copyleft obligation. For a research and teaching system distributed as source that is the correct and expected choice. For a team that wants to embed GAP in a proprietary product, it is a question to answer before starting, and the reference manual and the `LICENSE` file in the root directory are where the answer is.

The fourth is that the high performance configuration is a separate thing. The `hpcgap/` directory and `README.hpcgap.md` describe a parallel variant, and a team running GAP on a cluster is looking at a different deployment story from the single machine one.

## A mature project with four documentation builds and several channels

The signals of an established project are everywhere in this repository, and the documentation structure is a good example.

There are four separate documentation builds linked from the readme: a reference manual, a developer manual, an HPC manual and a tutorial manual, each with its own published URL. The reference manual is the one the licence section points you to for licence details, which tells you the manual is treated as the authoritative document rather than a leftover web page.

The community channels are equally established: a GAP forum on the project site, a GAP development mailing list at the university of Kaiserslautern, GitHub notifications, and a Slack workspace. The documentation says questions can be asked on the forum, which requires a subscription, or through the support channels, and issues go to the tracker.

The release record is regular. v4.16.0 was published on 2026-06-01, v4.16.1-beta1 on 2026-08-11, and v4.16.1 on 2026-08-23, and the last push to the repository was on 2026-10-19. A beta tag followed by a stable tag two weeks later is the normal pattern for a project that wants its packages tested against a new core before declaring it stable.

The repository also carries `AGENTS.md` and `CLAUDE.md` alongside `DEVELOPING.md`, which is the current sign of tooling support in an older open source project, and a `CITATION` file generated from `CITATION.in`, because the users of this system are exactly the people who publish papers that need to say which version they used.

## Conclusion

GAP fits a researcher or student in group theory, representation theory or combinatorics who needs a working implementation of an algorithm rather than a derivation, and it fits a course that needs a system students can read the source of. It does not fit a general purpose programming need, since the language is specialised, and it is the wrong choice for a team that wants a stable binary with no build step, because the development version does not ship with its package collection and requires bootstrapping. Before you build from source, install the GMP, zlib and Readline development headers, since without them GAP builds its own copies and the compilation gets slower, and read `INSTALL.md` and `README.buildsys.md` rather than improvising the steps.

## FAQ

### How do I build GAP from the development source?

Clone the repository, install a C compiler, a C++ compiler, GNU Make, GNU Autoconf and the GMP, zlib and Readline development headers, then run `./autogen.sh` to generate the configure script and continue as described in `INSTALL.md`. You need GNU make rather than BSD make, and the system is started with `./gap`.

### Why does a GAP development build need to bootstrap packages?

In contrast to the stable releases, the development version does not come bundled with all the GAP packages. You run `make bootstrap-pkg-minimal` or `make bootstrap-pkg-full`, and in the latter case you still have to build the packages that need compiling by running `../bin/BuildPackages.sh` from the `pkg` directory.

### Which dependencies are required to compile GAP?

At least a C compiler such as GCC or Clang, a C++ compiler, GNU Make and GNU Autoconf. The development headers for GMP, zlib and GNU Readline are recommended, because without them GAP builds its own copies, which slows the compilation, or omits certain features.

### What is GAP used for?

GAP is a system for computational discrete algebra with particular emphasis on computational group theory. It is used in research and teaching for studying groups and their representations, rings, vector spaces, algebras and combinatorial structures.

### What licence is GAP released under?

The GNU General Public License, version 2 or, at your option, any later version. The system including source is distributed freely, and the project states you can study it and modify or extend it for your special use.

## Sources

- [gap-system/gap on GitHub](https://github.com/gap-system/gap)
- [License: GPL-2.0](https://github.com/gap-system/gap/blob/master/LICENSE)
- [Project website](https://www.gap-system.org)
- [README](https://github.com/gap-system/gap/blob/master/README.md)
- [Releases](https://github.com/gap-system/gap/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/gap-system-gap
