Written July 08, 2017
curl -L -A "Install Jupyter" http://bit.ly/2sBxOGT | bash for
jupyter lab or
curl -L -A "Install Jupyter" http://bit.ly/2tY56U3 | bash for jupyter notebook.
If you use the jupyter notebook or jupyter lab daily there is no reason you should have to start the server every time you want to use jupyter. You can use a launchagent to automatically start a background jupyter process when you login. Add a bookmark and jupyter lab is always just one click away in your web browser.
Launch agents are controlled with
.plist files in a couple different locations.
for a user's launch agents are stored in
~/Library/LaunchAgents/. There are other locations for
system agents and things. I found the easiest way to learn about launch agents and launch daemons
is to download LaunchControl and mess around. You can
cross reference the more readable GUI representations in LaunchControl with the
Launch agents are similar to launch daemons except the run at login rather than on boot.
Open up Terminal and run
curl -L -A "Install Jupyter" http://bit.ly/2sBxOGT | bash. If you
don't want to run a random script (and you really shouldn't) go ahead and read it first at
http://bit.ly/2sBxOGT or below. If you want jupyter
and not jupyter lab, run this
curl -L -A "Install Jupyter" http://bit.ly/2tY56U3 | bash.
When you run this script you will have to enter a password that you will use to access jupyter lab. This is hashed before it is stored.
The script should open a web browser to jupyter, but you can also get there by going here for jupyter lab or here for jupyter notebook. I'd go ahead and bookmark that before you forget what port I chose.
The script (jupyter lab version)
You may want to tweak your configuration, and this is easy enough. Just edit the
This should open it in either TextEdit or LaunchControl if LaunchControl is installed. You
can reload the LaunchAgent with
launchctl unload ~/Library/LaunchAgents/com.$(whoami).jupyterlab.plist
launchctl load ~/Library/LaunchAgents/com.$(whoami).jupyterlab.plist.
If you are using notebook rather than lab, sub "notebook" for "lab."
Things you might want to change:
Run jupyter instead of jupyter lab
Remove the line
<string>lab</string>. I've created a script that does this,
as described above.
Change the starting directory
I set the root jupyter directory to my root directory so that I can browse anywhere (jupyter
does not let you browse higher than where it is started). You might want to change this. Edit
/ with your preferred path.
Change the port
Maybe you are already using port 8002 for something else. You can change the port
by editing this line
That's it! Hope you find this useful, if you had any issues with the script, please comment and I'll update it.