macOS
Install via Homebrew
A relatively easy way to install GAP is via Homebrew, a package manager for macOS. If you don’t have it already, install it first by following the instructions on its website.
Then enter the following command into a terminal:
brew install gap-system/gap/gap
Depending on your machine this may take a couple of minutes or longer, as it builds GAP and as many GAP packages as possible. Afterwards you can start GAP by entering
gap
into a terminal.
The GAP Homebrew tap is unofficial: the GAP team does not support it, and it may not always provide the latest GAP release. If it does not work for you, install from source.
Install from source
Step 1: Install prerequisites
You need the Apple command line developer tools, which provide a C and a C++ compiler and make:
- Open the Terminal application (found in the Utilities folder inside the Applications folder), enter the command
xcode-select --install, then press enter. - If it says
Command line tools are already installed
, you are done. Otherwise a window appears, asking whether you would like to install the tools now. Confirm this by clickingInstall
. - Wait for the download and installation to complete.
- Verify that the folder
/Library/Developer/CommandLineTools/usr/bin/exists and contains executables such asclangandclang++, the C and C++ compilers.
We also recommend installing GMP and GNU Readline; without the latter, command line editing in GAP is limited. With Homebrew:
brew install gmp readline
With MacPorts:
sudo port install gmp readline
Several GAP packages have additional dependencies, listed in INSTALL.md. With Homebrew, install most of them with
brew install autoconf automake libtool cddlib curl fplll libmpc \ libx11 mpfi mpfr nauty ncurses pari singular xorgproto \ zeromq
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
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
Gap.app
Gap.app is a native macOS frontend and distribution of GAP, developed by Russ Woodroofe. The “Gap.app + GAP” edition includes a fairly complete copy of GAP, and can be installed by simply downloading a disk image and dragging Gap.app to the Applications folder. You can also install the built-in GAP for use from your usual terminal via the Install GAP Command For Shell menu option (found under the Gap menu in the GUI frontend).
The included GAP comes with working copies of most of the packages in the standard GAP distribution. Gap.app is compatible with XGAP, and allows interactive display of subgroup lattices with the GraphicSubgroupLattice command. The version of GAP that comes with Gap.app may lag slightly behind the very latest. Full details on the currently included GAP may be found in the Gap.app FAQ.