Ask Your Question
1

SageMath on macOS: app, components, packages, SageTeX

asked 2020-07-31 18:07:54 +0100

Gnossos gravatar image

updated 2020-07-31 22:59:06 +0100

slelievre gravatar image

I'm brand new to SageMath and having trouble getting my bearings. Can you help with these things:

  • On macOS 10.14.6, I downloaded and installed sage-9.1-OSX_10.11.6-X86_64.app.dmg from the SageMath download mirror at MIT. But although the app starts the way the page says, "like most other Mac applications," the interface is quite different from most other Mac applications. Instead of the usual sequence, "AppName, File, Edit, View, ... Window, Help," Sage has "Sage, File, Server, Terminal Session, Development, Help." I recognize "Sage," "File," and "Help," but not the rest. Is there introductory documentation or a tutorial somewhere that explains how to use Sage from this interface?

  • Regarding the installation itself, the SageMath components documentation lists 84 separate components. Some of these, like R and Python, I already have installed and use regularly in different contexts. Does SageMath install duplicates, or does it use the already installed versions? And in either case, how does SageMath handle component updates and possible incompatibilities associated with them?

  • I want to use SageMath with LyX and therefore need SageTeX. In the SageMath documentation, the SageTeX tutorial says SageMath comes with SageTeX, and all one needs to do is to make TeX aware of it. But the page refers to SAGE_ROOT, and since I installed using the .dmg file, I'm not really sure where SAGE_ROOT is. How does one find it?

edit retag flag offensive close merge delete

Comments

Welcome to SageMath! Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2020-07-31 23:00:06 +0100 )edit

I turned the urls into links in the question, and made other minor edits.

If you disapprove any of those, please feel free to edit back.

slelievre gravatar imageslelievre ( 2020-07-31 23:02:06 +0100 )edit

The easiest way to get up and running with Sage and sagetex is with a free Cocalc account. This avoids the sort of technical issues you're experiencing now.

dazedANDconfused gravatar imagedazedANDconfused ( 2020-08-01 02:37:13 +0100 )edit

@dazedANDconfused --- CoCalc does make it easy! Thanks for mentioning it!

But it's also nice to be able to work on one's computer and not depend on internet access.

slelievre gravatar imageslelievre ( 2020-08-01 02:50:03 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-07-31 21:28:25 +0100

slelievre gravatar image

Docs for SageMath macOS interface

Thanks for pointing out the need for better documentation of the SageMath macOS app interface.

SageMath components

Regarding components, the answer is: SageMath ships its own components.

Suggestions once you have installed the macOS SageMath app:

  • create a symbolic link to the sage executable somewhere in your PATH

    The easiest way to do that is by running the following command from inside Sage:

    sage: !ln -sf $SAGE_ROOT/sage /usr/local/bin
    

    Then when asked, type the password for the current macOS user (this should be run by a user who is an admin for that Mac).

    Once that is done, you can start the Sage REPL (read-eval-print loop, also known as "command-line interface" or "Sage in the terminal") in any terminal session by using the command sage.

  • fix your Sage using the T3M group's fix_mac_sage

    That will enable SSL and Tkinter for the Python shipped by Sage.

    SSL is useful for secure downloads, in particular for using pip, the Python package installer.

    Tkinter is a graphical interface toolkit for Python, used by some optional packages of Sage, such as SnapPy.

  • to install extra pip packages, use the pip command

    One way to do that is from inside a Sage session:

    sage: !pip install some_package_name
    

    Another way is in a shell session (without starting Sage):

    $ sage --pip install some_package_name
    
  • to install extra R packages, start Sage's R

    $ sage --R
    

    and do as you would in R.

  • to install extra GAP packages,

    • install the optional package gap_packages

      $ sage -i gap_packages
      
    • start Sage's GAP

      $ sage --gap

    and use the GAP package PackageManager as you would in GAP.

SageTeX for the macOS SageMath app

Follow the instructions on the documentation page you mentioned.

Two ways to find SAGE_ROOT:

  • in a Sage session:

    sage: print(SAGE_ROOT)
    
  • in a shell session:

    $ sage -c 'print(SAGE_ROOT)'
    

Other tips for SageMath on macOS

  • Install JupyterLab

    sage: !pip install jupyterlab
    

    You can then start Sage in JupyterLab

  • Install RISE

    sage: !pip install RISE
    

    You can then turn Jupyter notebooks into presentations.

    Currently works with Jupyter Notebook but not with JupyterLab.

edit flag offensive delete link more

Comments

While I can't comment knowngly about this comment (I won't touch macOS with a 10-feet pole...), it seems exceedingly useful for macOS users.

May I suggest you to turn it in a piece of official Sagemath documentatipn, possibly with a reference in README.md ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-08-01 19:29:52 +0100 )edit

@Emmanuel Charpentier - Good point. So far taking every opportunity to share my private notes as answers to questions people ask. Hope some of that can become official documentation at some point.

slelievre gravatar imageslelievre ( 2020-08-02 04:05:41 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-07-31 18:07:54 +0100

Seen: 874 times

Last updated: Jul 31 '20