Ask Your Question
2

How To Accept Remote Network Connection

asked 2017-11-09 02:45:37 +0100

bso gravatar image

updated 2020-01-12 13:27:44 +0100

FrédéricC gravatar image

Hi, I use Mac OS's native Sage App. I can access Sage's Jupyter notebook from that Mac using localhost:8888. I researched a bit and find out if another computer needs to browse the same Jupyter notebook, one needs to start juypter by passing --ip '*' (otherwise it only accepts localhost traffic and will give a Connection Refused error).

But since I am clicking a Mac OS Sage icon to start the server... I am not sure how I can specify the command line option. Please give me some hints.

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2017-11-13 07:24:07 +0100

bso gravatar image

I found the answer myself... writing it up here in case other Mac users have the same question:

Edit the file /Applications/SageMath-8.0.app/Contents/Resources/sage/local/etc/jupyter/jupyter_notebook_config.py so that it has the following line somewhere:

c.NotebookApp.ip = '*'

Restart Sage App afterwards.

edit flag offensive delete link more
1

answered 2017-11-16 02:51:01 +0100

slelievre gravatar image

If the Sage app is at /Applications/SageMath-8.0.app, starting the Jupyter notebook with the option you want can be achieved by typing the following in a terminal.

$ /Applications/SageMath-8.0.app/Contents/Resources/sage/sage -n jupyter --ip '*'

(type everything that follows the $ prompt, but not the $ prompt itself).

To make this simpler, you could place a symbolic link to the Sage executable somewhere in your path. For this, type the following in a terminal

$ sudo ln -s /Applications/SageMath-8.0.app/Contents/Resources/sage/sage /usr/local/bin

and enter your password when asked to.

Explanation: ln -s TARGET LOCATION places a symbolic link to TARGET in LOCATION. Here the target is the Sage executable, /Applications/SageMath-8.0.app/Contents/Resources/sage/sage, and the location is /usr/local/bin. The command is called with sudo ("super-user do") because you need admin rights to write in /usr/local/bin.

From then on, you can call Sage in a terminal by just typing

$ sage

and you can launch the Jupyter notebook by typing

$ sage -n jupyter

and you can launch the Jupyter notebook accessible from all IP addresses by typing

$ sage -n jupyter --ip '*'

If in addition you type the following in a terminal,

$ sudo sage -c "install_scripts('/usr/local/bin')"

then shortcuts to start GAP, PARI/GP, R, Singular, etc. will be placed in /usr/local/bin so that you can launch those by typing in a terminal:

$ gap
$ gp
$ R
$ singular

etc.

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

Stats

Asked: 2017-11-09 02:45:37 +0100

Seen: 2,533 times

Last updated: Nov 16 '17