on MacOS

Whilst MacOS provides a copy of python (at least until ), it is only python 2, with only the core packages, and no easy way to add to them. So here we suggest installing python 3, which will require around 150MB of disk space (and a little more during the installation).

Python 3 for MacOS can be downloaded from - hover on Downloads, and press the MacOS X download button. When it finishes, click on "Install Certificates" as instructed.

To see if this step was successful, open a Terminal window (found in the Utilities subfolder of Applications, not in Applications itself), and type:

  python3 --version

The response should be 3.8.2 (or later).

Two python packages are much used on this site, and not installed by default. It is probably best to add them now, by typing in the Terminal window:

  pip3 install --user numpy
  pip3 install --user matplotlib

Then one should test the above, again in the Terminal window (with the end of the prompt now shown):

~$ mkdir maths
~$ cd maths
~/maths$ curl -O
~/maths$ python3

This should display the Mandelbrot Set example. Similarly

~/maths$ curl -O
~/maths$ python3

should find all Mersenne primes up to M3300.

Want more Mersenne primes? One can open the python code as a text file with

~/maths$ open -a TextEdit

and change the 3300 to 4424. Press Apple S to save the file, and then type

~/maths$ time python3

That would take a Pi 4 running 32 bit Raspbrian 54 seconds. It took a late 2011 MacBook Pro (64 bit) 13.3 seconds (or 19.6 seconds with the Turbo Boost off).

If you have reached this point successfully, you should also be able to run most of the examples on this website.

A C compiler

One might also wish to install a C compiler for a couple of the examples on this website. To install that provided by Apple, but not installed by default, simply type in a Terminal window:

gcc --version

If gcc is not already installed, MacOS will ask whether you wish to install the "command line developer tools." It will take another 150MB or so.