## Installing GAP on a Mac

I love GAP. I use it almost every day, so I wanted to install it on my new home computer, a MacBook. The instructions were reasonably good, but I ran into two problems that I struggled with.

1. My computer did not come with a gcc compiler installed. This is necessary to install. Fortunately, there is a free download. The instructions for doing this can be found here.
2. I did not have access to my usr/local/bin directory. Fortunately, I am friends with Ben Newton, who explained what I should do. He says to:
1. Log on as the root user by typing “su root” from a terminal window. To enable the root user, see this webpage.
2. Create directory /usr/local/gap.
3. Change the ownership to your usual profile using the “chown” command.
4. Log out.
5. Follow the instructions on the GAP website.
6. Solve some famous problem on GAP and become famous.

Everything worked well after this.

Tags: ,

### 7 Responses to “Installing GAP on a Mac”

1. dhdung1309 Says:

Thanks for sharing.

I have installed GAP in Ubuntu and I am trying to learn some basic of GAP. It is so fantastic. However, I need time to get used to it.

• bretbenesh Says:

It really is a great tool for developing conjectures. It is also great for existence proofs. Let me know if you want any of my code; it isn’t pretty, but it could be useful if you want to learn about GAP. In particular, I have several versions of code to computer $P_G(s)$ (unless I deleted my old versions). Bret

• dhdung1309 Says:

Cool. Yep, I think I need them to start trying some basic commands to compute $P_G(s)$. Could you please send me then. (to : dhdung1309@gmail.com ).

Thanks a lot.^^

Dung

2. Arthur Gaer Says:

1) GAP is included as a component of Sage, so one could install the Sage package and get both GAP and all the other open source mathematical software also included in SAGE. http://www.sagemath.org/

2) Enabling the root user is a bad idea for a number of security reasons–which is why it’s disabled on a Mac in the first place. A better approach (if you’re an admin user, which you must be in order to enable root anyway) is to use sudo–either sudo the commands you need to use to install bash (e.g.

sudo mkdir /usr/local/gap

or just sudo to a shell

sudo /bin/bash

and then perform all the steps necessary to install GAP within that sudo’d shell. And with the latter approach the chown command shouldn’t be necessary.

• bretbenesh Says:

Thanks for the help, Arthur. Using the sudo command does seem to be better.

I use Sage, and I really like Sage. My problem with using GAP through it, though, is that the syntax is different. This means that all of my old code does not work with it. I suppose that I should start programming through the Sage interface.

• Arthur Gaer Says:

Don’t know if it would get you what you need (if not, pointless for your purposes) but there is command-line GAP available within Sage, which I’m guessing will work interactively just as the stand-alone GAP does (it does claim on startup to be exactly the latest 4.4.12 GAP).

To get it to work the way you probably want (from README.txt inside the Sage installed directory), inside Sage, sudo’d to admin privileges:

install_scripts(“/usr/local/bin/”)

Which will install the gap script, amongst some others.

Then, because the install_scripts script doesn’t actually install a “sage” script (I recently filed a bug report on that) create in /usr/local/bin an appropriate sage script, e,g,

#!/bin/sh
/Applications/sage/sage \$*

And make it executable (“chmod 755 /usr/local/bin/sage”)

Finally, one can then install the GAP packages from within sage:

sage -optional

gives you the list of all optional packages wherein

sage -i database_gap-4.4.12.p0

and

sage -i gap_packages-4.4.12.p0

installs the current versions of the GAP database and packages.

Not sure if this is helpful for you, but might be for others!

• bretbenesh Says:

Arthur,

This is great. I will play around with it. Bret