Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nathanielobrown/1614c1011d8eb5aad291fda7c60c5563 to your computer and use it in GitHub Desktop.
Save nathanielobrown/1614c1011d8eb5aad291fda7c60c5563 to your computer and use it in GitHub Desktop.
script to install a jupyter launch agent on MacOS
cat <<EOF > ~/Library/LaunchAgents/com.$(whoami).jupyternotebook.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.$(whoami).jupyternotebook</string>
<key>ProgramArguments</key>
<array>
<string>$(which jupyter)</string>
<string>notebook</string>
<string>--notebook-dir=/</string>
<string>--no-browser</string>
<string>--port</string>
<string>8003</string>
<string>--NotebookApp.password=$(python -c "from __future__ import print_function; from notebook.auth import passwd; print(passwd())")</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
launchctl load ~/Library/LaunchAgents/com.$(whoami).jupyternotebook.plist
sleep 2
open http://localhost:8003/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment