# Installing the Conjecturing package for Sage on MacOS Mojave

2019 November 10

Alas, the instructions for installing the Conjecturing package for Sage posted on Nico Van Cleemput’s Conjecturing website did not work for me right out of the box. So, in hopes of saving others a little time (or misery) here are instructions to perform a local installation of the Conjecturing package for Sage on macOS Mojave, as of 10 November 2019. Only use these if you strike out using Van Cleemput’s instructions.

All usual disclaimers and provisos apply. No warranties or representations. Mileage may vary.

### Preliminaries

You will need a working installation of Sage 7.3 or later. As of this writing Sage 8.9 is current. Instructions here have been tested with Sage 8.9.

Before you try installing the Conjecturing package, try running sage -i from a command prompt. This is a preflight check to make sure Sage can build packages before we try building Conjecturing. Rebuilding Sage in this way may take a small eternity. Go do something else. Stretch. Get a cuppa. Read a journal article. Eventually, you should see “Sage build/upgrade complete!” If not, best to fix any issues before trying to build Conjecturing.

### How to install

• Download the latest Conjecturing package (0.12 as of this writing) from Nico Van Cleemput’s Conjecturing website. You’ll have a file conjecturing-0.12.tar.gz. Unzip / untar this file (but keep the original!). You should have a folder called conjecturing-0.12.

• Open conjecturing-0.12 and read the README.md. There’s a subfolder called spkg. Open that and read the README.md there too! These provide instructions for installation.

• For the lazy who skipped the previous step. Find the location of your Sage installation. To do this, go to a command prompt and type which sage, e.g.:

So in this example SAGE_ROOT is /Applications/SageMath

• Copy the directory found in the extracted archive spkg/conjecturing into the directory SAGE_ROOT/build/pkgs, e.g.,

• Copy the entire archive file conjecturing-0.12.tar.gz into SAGE_ROOT/upstream, e.g.,

• Run the following command:

• Install the package using the following command:

The first time I did this, the build failed. Here’s what I did to fix. First, Sage complained that spkg-install should not be flagged as executable. Fix:

Second, Sage complained that spkg-install should not have a shebang and that such would be prepended dynamically, so…

…and remove the shebang (that’s the first line that starts with #!), save, and exit. (Obviously if you don’t use vim you can use your favorite text editor (e.g., vi, Atom, Sublime, Emacs, nano, TextMate, whatever).

Third, Sage complained that malloc.h was not found. (Groan.) If this happens to you, here’s a fix:

Why? Because Apple, that’s why. See relevant Apple developer docs. Note: These instructions should work for macOS 10.14 Mojave with Xcode 11.2. Installation of headers took about 5 minutes on my machine. Note: For macOS 10.15 Catalina and Xcode 11.3 (which I strongly discourage as of this writing), this may work instead export CPATH=xcrun --show-sdk-path/usr/include/malloc.

If you get a complaint from the installer (above), because you don’t have the command line tools installed yet, try running this first:

For some reason the Sage installer seems not to respect CFLAGS, so I had to export this environment variable before running the Sage installer again:

The installer will spew gobbledygook all over your screen and it should (with a little luck) end with: “Sage build/upgrade complete!”

Now you should have the Conjecturing package installed! Yay! To confirm, start Sage, and run this command from a sage prompt:

sage: attach('conjecturing.py')


If this doesn’t work for you. Shoot me an email or swing by my office.

Tags: mathematics