0

I would like to change the default browser for starting the Jupyter Notebook directly from Anaconda Navigator (the current browser is Chrome, but I want to open the notebook in Safari).

I can start Jupyter Notebook in Safari by running the following code in Terminal: jupyter notebook --browser safari (based on this answer).

Is there a way to define a different browser for launching the notebook from the Navigator?

ljushu
  • 105
  • 1
  • 10

2 Answers2

2
  1. Open Anaconda Prompt and run upyter notebook --generate-config

  2. This writes a file to C:\Users\username\.jupyter\jupyter_notebook_config.py

  3. Copy the link C:\Users\username\.jupyter\ and browse to the file location and open it in IDLE editor

  4. Search for the following line in the file: #c.NotebookApp.browser = ''

  5. Remove the # at the beginning of the line to allow the line to execute.

  6. Add the browser target link inside the single quotes c.NotebookApp.browser = 'ENTER TARGET LINK HERE'

  7. To find the browser target link, go to search and look for the browser you want to use. In your case, Safari.

    Right click and select “open file location”
    Right click on the file, select properties and copy the Target link

  8. Paste the target link inside the single quotes and make sure you delete the double quotes and use forward slashes in your path. (Backslashes are use in double quotes, Forward slashes in single quotes)

  9. Add %s before closing the single quote, so it reads our path as a browser command and add the letter u before the first single quote to indicate this is a unicode string c.NotebookApp.browser = u'BROWSER TARGET LINK HERE %s' and save the file.

  10. Go to Anaconda Navigator and launch jupyter notebook. You will see your selected browser being set to Jupyter notebook.

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
1

Right, so digging a bit deeper into the Anaconda documentation, I've found that it's pretty simple, actually. I found the config file at ~/.jupyter/jupyter_notebook_config.py, uncommented the default line # c.NotebookApp.browser = '' and modified it so that it points to the Safari's executable:c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app %s'.

ljushu
  • 105
  • 1
  • 10