install:macos

The latest release 4.9 should work on all Mac OS versions greater or equal to 11. The installation requires a couple of steps (of which you have maybe done some already for other reasons):

  • Install the xcode command line tools
  • install Homebrew
  • install Perlbrew
  • install some dependencies using Homebrew
  • install some dependencies using Perlbrew/cpanm
  • install a python dependence
  • download and install polymake

For all steps you need an open Terminal. You can find the Terminal app in the Subfolder Utilities of Applications.

If you don't want to install Homebrew, you can try to install dependencies yourself. Some instructions are here.

In the terminal type

xcode-select --install

Either this tells you that your command line tools are installed or opens a small window that asks you whether you want to install them. Confirm. It also offers to install the full XCode IDE. This is not necessary and not recommended (you then need to install the command line tools on top from within XCode).

Installation instructions are here. In most cases it should be sufficient to copy and execute the first code line on that page into your terminal, that is:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Installation instructions are here. In most cases it should be sufficient to copy and execute the first code line on that page into your terminal, that is:

\curl -L https://install.perlbrew.pl | bash

We have to add some variables to the shell environment. Recent macs usually use zsh as their shell. You can check this with

echo $SHELL

If you use bash, you have to

  • replace .zshrc with .bashrc in the terminal commands below
  • add
    if [ -f ~/.bashrc ]; then . ~/.bashrc; fi 

    at the end of the file $HOME/.bash_profile if it is not already present

Now add some paths to your Terminal config and reload the config. For an Intel Mac type the following lines in the terminal:

echo "export PERL5LIB=$HOME/perl5/lib/perl5:$HOME/perl5${PERL5LIB+:$PERL5LIB}" >> $HOME/.zshrc
echo "source ~/perl5/perlbrew/etc/bashrc" >> $HOME/.zshrc
echo 'export ARCHFLAGS="-arch x86_64"' >> $HOME/.zshrc
source $HOME/.zshrc

and for a Silicon Mac use

echo "export PERL5LIB=$HOME/perl5/lib/perl5:$HOME/perl5${PERL5LIB+:$PERL5LIB}" >> $HOME/.zshrc
echo "source ~/perl5/perlbrew/etc/bashrc" >> $HOME/.zshrc
echo 'export ARCHFLAGS="-arch arm64"' >> $HOME/.zshrc
source $HOME/.zshrc

Run the following lines in your terminal:

brew install gmp
brew install mpfr
brew install boost
brew install readline
brew install ppl
brew install flint
brew install singular
brew install python3
brew install ninja
brew install ccache
brew install mongo-c-driver
brew install jupyterlab

Run the following lines in your terminal:

yes N | perlbrew install-cpanm
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
cpanm SVG
cpanm JSON
cpanm install Net::SSLeay
cpanm Term::ReadLine::Gnu
cpanm Term::ReadKey
cpanm XML::SAX

You find the sources here. Get the source tarball from the Linux section of that page. Download to Downloads.

In the terminal do

cd Downloads
tar -xvjf polymake-4.13.tar.bz2

Compilation

Finally, we can compile and install polymake. This requires one more choice on your side.

  1. You may opt to install polymake into the standard installation location for additional software on your computer. This will place the compiled version of polymake into the directory /usr/local.
  2. You may also provide a separate directory in your home folder for the compiled version of polymake.

For the first option you will need administrator permissions for your computer and probably prefix the commands below with sudo. The advantage of this choice is, that /usr/local/ is contained in the search path for programs, and polymake will directly be found.

Advantage of the second option is, that you do not need administrator permissions for the installation, and have all files related to polymake in one location. This makes it easier to install new versions or remove polymake. We strongly recommend the second option.

If you opt to install into a subfolder of your home folder, then please create one before proceeding. For this, create a folder with

mkdir $HOME/<polymake_install_folder>

where <polymake_install_folder> is a name of your choice, e.g. polymake_bin. You will need the name of the folder for the commands below.

In the command below, you will also need to replace all occurences of <brew-install-location> by

  • /usr/local/ if you have an Intel Mac and installed brew in the default location
  • /opt/homebrew if you have an M1/M2/M3 Mac and installed brew in the default location
  • with the directory you installed brew into, if you chose a nonstandard location for the installation

Finally, we can compile polymake. If you chose option 1. above, then compile with:

cd ~/Downloads/polymake-4.13
./configure --without-java --with-brew=<brew-install-location>
ninja -C build/Opt -j2 install

If you chose option 2., then compile with

cd ~/Downloads/polymake-4.13
./configure --without-java --with-brew=<brew-install-location> --prefix=$HOME/<polymake_install_folder>
ninja -C build/Opt -j2 install

You can then call polymake with

$HOME/<polymake_install_folder>/bin/polymake

or just

polymake

if you chose option 1.. For option 2., if you first do

export PATH=$PATH:''$HOME/<polymake_install_folder>/bin/''

in a terminal, then you can also start polymake by just typing polymake. You can add this line also at the end of the file $HOME/.zshrc to add the polymake installation folder to the path permanently.

Configuration

If you use Safari as your default browser, then you need to switch to another one for polymake. Please do

set_custom $Visual::webbrowser="open -a Firefox";

inside the polymake shell. Replace Firefox by Google Chrome if you prefer this browser.

  • install/macos.txt
  • Last modified: 2025/03/17 22:59
  • by gawrilow