Search code examples
pythonjupyter-notebooklaunchctl

Is it possible to start a Jupyter notebook on a boot?


I would like to open a Jupyter notebook page on the boot of my Mac. Specifically, I use the launchctl to start the Jupyter notebook.

However, after the reboot, the web page showed the password or token to verify:

enter image description here

Here is the launchctl script I use on High Sierra. I find it painstaking to bother to type in the token. So is it possible to ignore the token verification on reboot, just like it is when you type in jupyter notebook?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
           http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>me.jupyter</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/jupyter</string>
      <string>notebook</string>
      <string>--no-browser</string>
      <string>--port</string>
      <string>9090</string>
      <string>--notebook-dir</string>
      <string>/Users/me/jupyter/</string>
    </array>
    <key>KeepAlive</key>
    <true />
    <key>RunAtLoad</key>
    <true />
    <key>StandardErrorPath</key>
    <string>/Users/me/jupyter/jupyter-notebook.stderr</string>
    <key>StandardOutPath</key>
    <string>/Users/mejupyter/jupyter-notebook.stdout</string>
  </dict>
</plist>

Solution

  • This might work for you:

    If you do not care about the security of the server, you can first create a jupyer config file with: cd ~/.jupyter jupyter notebook --generate-config Then set the c.NotebookApp.token parameter to an empty string in the configuration file created c.NotebookApp.token = '' As said in comment, Setting to an empty string disables authentication altogether, which is NOT RECOMMENDED.

    Source: https://github.com/jupyter/notebook/issues/2254