Jupyter Service on MacOS
Published on .
I use Jupyter enough that I want it to be always running on my Mac, particularly after restarts. Here is how to configure it as a service.
- Put the following XML into
~/Library/LaunchAgents/local.jupyter.plist
- Run
launchctl load ~/Library/LaunchAgents/local.jupyter.plist
And that’s that. I used the full path since launchctl
was cranky.
<?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>local.jupyter</string>
<key>ProgramArguments</key>
<array>
<string>/Users/ntaylor/.pyenv/shims/jupyter</string>
<string>lab</string>
<string>--no-browser</string>
<string>--NotebookApp.token</string>
<string>''</string>
<string>--NotebookApp.password</string>
<string>''</string>
<string>--notebook-dir</string>
<string>/Users/ntaylor/notebooks</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/ntaylor</string>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/ntaylor/.jupyter/jupyter.log</string>
<key>StandardErrorPath</key>
<string>/Users/ntaylor/.jupyter/jupyter.log</string>
</dict>
</plist>
Code language: Python (python)