Ask Your Question

How can I alter default local sage configuration?

asked 2016-05-13 03:52:52 +0100

DBS gravatar image

I have installed sagemath on my computer. Now I would like to change some default configuration options. For example my default browser is Firefox but I would like sage to use Chrome. If possible I would also like to define default home directory on sage. I presume there is a configuration file....where can I find it?

Thanks in advance for your help!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-05-14 17:09:32 +0100

edit flag offensive delete link more


Thank you! I am using sage in a linux system. In my home/.sage folder there seems to be no init.sage folder. What I have instead are the following folders: cache, db, gap, gp-expect.log, ipython, ipython-2.1.0, ipython-2.3.0, ipython-2.3.0.p0, ipython-3.0.0.p1, ipython-4.0.0, ipython_genutils-0.1.0, matplotlib-1.1.0, matplotlib-1.3.1, matplotlib-1.4.3, matplotlib-1.5.0, matplotlib-1.5.1, R, sage_notebook.sagenb, sage.txt, temp, tmp

DBS gravatar imageDBS ( 2016-05-16 01:27:01 +0100 )edit

init.sage should be a file, not a folder, and you should create it if it doesn't exist.

John Palmieri gravatar imageJohn Palmieri ( 2016-05-16 17:43:17 +0100 )edit

Oh, and it is a .sage file, so use Sage syntax in it.

John Palmieri gravatar imageJohn Palmieri ( 2016-05-16 18:33:28 +0100 )edit

Thank you. I didn't have an environment variable SAGE_BROWSER in my bash profile so I created one in my .bashrc file. However it still doesnt seem to implement it. Any ideas?

DBS gravatar imageDBS ( 2016-05-17 00:35:25 +0100 )edit

Maybe a silly question, but did you open a new shell so that changes in your .bashrc file took effect? If you run the shell command export, does it list SAGE_BROWSER? Meanwhile, you can experiment without restarting the shell by running export SAGE_BROWSER='/usr/local/bin/my_favorite_browser' and then running Sage.

John Palmieri gravatar imageJohn Palmieri ( 2016-05-17 00:55:44 +0100 )edit

answered 2016-05-21 23:09:10 +0100

DBS gravatar image

updated 2016-05-22 01:25:36 +0100

I accepted the answer above. In the spirit of someone else having similar issue here is what worked for me. I found the sage documentation somewhat unclear.

I took the following steps:

  • Create a init.sage file in .sage folder (most likely located in home folder) with the following code in it. Use the code :
    from sage.misc.viewer import viewer
    viewer.browser('open -a /path to your_fav_browser/YOUR_FAV_BROWSER')
    where YOUR_FAV_BROWSER is the browser you want.

  • Add the code export SAGE_BROWSER="YOUR_FAV_BROWSER"

NOTE: I am assuming bash already knows the path to YOUR_FAV_BROWSER.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2016-05-13 03:52:52 +0100

Seen: 1,483 times

Last updated: May 22 '16