This was posted on MSE originally.

Please note that my only training in programming of any kind is in the context of mathematics, specifically group theory. Thus, please use minimal technical language.

The Problem:

I'm trying to get GAP on my Android phone.

(I'm using a ZTE Blade V8. I doubt that matters.)

What I have so far:

I found on the GAP forum that someone called Matan Ziv-Av compiled a version of GAP for Android that can be found here (and more specifically here).

This explains something I don't understand.

I have downloaded the latest file, last updated in 2015 (so it's gap4r6), but, upon opening it with RAR, I have been unable thus far to run the programme.

Here is a screenshot of the file I think I need to click on to get started:

(Click image to enlarge it)


I can't seem to get it working.

Please help :)


Using Termux with the file in the screenshot above, I got this:

(Click image to enlarge it)


  • The original MSE question.
    – Shaun
    Oct 30, 2018 at 4:15
  • Have you tried installing Terminal Emulator for Android or Termux? Based on the announcement link you should be able to install either and get a Linux like environment to run your package. Of course perhaps a required step is to understand how to get around in Linux/Unix, your level of ability on that point is unclear. Oct 30, 2018 at 5:28
  • @MorrisonChang I've tried the former, no luck there - uninstalled. I'm downloading the latter now.
    – Shaun
    Oct 30, 2018 at 5:33
  • 1
    Sorry don't know Termux, but this seems related: Where is the folder that Termux defaults to?. Another path could be to install your 'GAP' software on a regular PC running Linux and use an Android SSH client to remote into it, you'll need to have a network connection to make that work. Either way you'll need to have an understanding of Linux command line even if you got GAP on Android working. Nov 5, 2018 at 5:08
  • 1
    @Shaun do you always get that getprop message when opening termux? That indicates that something went wrong during the app installation (or that something is weird on your phone). Could you try reinstalling the app and opening termux again to see if it persists? This github issue (sort of) describes the error: github.com/termux/termux-app/issues/849
    – user155804
    Nov 14, 2018 at 15:31

2 Answers 2


This is how I got it to run.

I'm using the download from here GAP for Android

Preparations: In termux type termux-setup-storage when prompted to give termux storage permission select allow. This is to give access to the sdcard in termux.

  1. Make sure your connected to the internet.
  2. In termux, type pkg install wget press enter.
  3. Now to download the file type wget my.svgalib.org/android/gap4r5-1.tar.gz then hit enter.

  4. Extract the file type tar -zxf gap4r5-1.tar.gz hit enter.

  5. Type cd gap4r5 hit enter.

  6. Now we need to make a couple of changes to the script for it to run on termux. We will copy it to the sdcard Download file to be able to edit it. type cp gap.sh /storage/emulated/0/Download/ hit enter.

  7. Now open the file gap.sh in a text editor, I used Notepad++ for Android. This file is in your Download folder.

  8. Edit line #1 to look like this #!/data/data/com.termux/files/usr/bin/bash

  9. Edit line #23 to look like this GAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" Its very important on this line to have the spaces exactly where they are and nowhere else. then save the file. (Thanks for this line goes to Dave Dopson at this post Getting the source directory of a Bash script from within )

  10. Go back to termux and type cp /storage/emulated/0/Download/gap.sh . (the period at the end is important) and hit enter.

  11. Now you are ready to start using the program. to run the program make sure you are in the folder gap4r5 and type ./gap.sh. (To get to this folder when you start termux type cd gap4r5 or wherever you are in termux type cd hit enter and type cd gap4r5 and hit enter).

Good Luck!

  • I couldn't do step 6. My phone denied Termux the permission to execute the demand.
    – Shaun
    Jan 11, 2019 at 12:43
  • 1
    Did you run termux-setup-storage and give termux the permission?
    – Sruly
    Jan 11, 2019 at 14:00
  • I did, and I've tried it multiple times since that. It hasn't worked, I'm afraid. See this image where I get stuck on part 4. I'm sorry that this is taking me so long. (In my defence, I haven't been trying this out much over the last few weeks.)
    – Shaun
    Feb 27, 2019 at 22:10
  • From the error message it seems there may be something wrong with the tar file. Can you try re-downloading the file (step #3) again.
    – Sruly
    Feb 28, 2019 at 22:08
  • @Shaun Check the MD5 hash of the file and make sure it matches this "12CC0203386FB891D9DDCA86222797FD". If not try re-downloading the file (step #3) again.
    – Sruly
    Feb 28, 2019 at 22:21

Since GAP is open-source you can download the sources and compile them on device in termux or another terminal emulator (though other terminal emulators don't provide the compilation tools AFAIK).

There are quite detailed compilation instructions in the "README.buildsys.md" file in the gap source directory, have a look at that for some more details. Here are the steps I did to compile it (after opening a termux shell), lines starting with "#" are comments and are hence suppose to help you understand what the following line(s) does.

# Install programs needed to compile gap
pkg install make clang m4
# Install some optional dependencies that probably enhance your gap experience
apt install readline-dev libgmp-dev
# Download sources
wget https://www.gap-system.org/pub/gap/gap-4.10/tar.gz/gap-4.10.0.tar.gz
# Extract sources and change to that folder
tar -xf gap-4.10.0
cd gap-4.10.0
# Create a build folder to keep source directory clean
mkdir build
cd build
# Configure the package, if you want special features you probably want to change this line
# Compile the package
# Run GAP!

Please let me know if you run into any errors (I might have missed some dependencies) or if I should explain something in more details. Also note that you have to compile and run gap from termux's folder structure (/data/data/com.termux/files/), android doesn't allow executable files in the shared storage (like the external and internal sdcard).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .