How to Launch Jupyter Notebook Quickly (Mac)

Alice Zhao
3 min readAug 29, 2022

The Problem

You are tired of typing jupyter notebook into your Terminal each time you want to launch a Jupyter Notebook on your Mac.

NOTE: This post was inspired by a similar tutorial by Benjamin Dornel. His tutorial has details on how to create aliases on a Windows machine.

A Solution

You can create a zsh alias shortcut so that every time you type jn, your computer recognizes it as jupyter notebook.

This is a one-time fix that should take just a few minutes to set up by going through the following steps:

  1. Access the .zshrc file
  2. Add the line alias jn="jupyter notebook"
  3. Save your changes

1. Access the .zshrc file

In your Terminal, type:

vim ~/.zshrc

This will open up a hidden file called .zshrc. The file might either be empty or have some existing content in it, which you can ignore. Here’s what mine looks like:

Screenshot of my .zshrc file

NOTE: You may see some tutorials talk about editing .bash_profile instead of .zshrc. The newer MacBooks now use zsh instead of bash, so I recommend editing the .zshrc file.

2. Add a line of code

To edit the .zshrc file in vim:

  1. Type i

Once you do this, you should see — INSERT — appear at the bottom of the screen. You are now in edit mode in the vim text editor.

2. Add the line alias jn="jupyter notebook" to the top of the file

You can use the up / down / left / right arrows on your keyboard to navigate around the file.

NOTE: Make sure to type the line exactly how you see it above. Notice the lack of spaces around the equal sign and the double quotes.

Screenshot of my .zshrc file with the alias code at the top

3. Save your changes

To save the vim file:

  • Press Esc on your keyboard. This will switch you from edit mode to normal mode.
  • Next, type :wq to save your changes and quit vim.

Once you are out of vim, the final step is to reload the .zshrc file so that typing jn will actually work.

source ~/.zshrc

Problem Solved!

You can now launch a Jupyter Notebook using the shortcut jn. Give it a try!

To launch Jupyter Notebook:

(base) alice@Alices-MacBook-Pro ~ % jn

To open a particular notebook:

(base) alice@Alices-MacBook-Pro ~ % jn my_python_code.ipynb

There are other ways to quickly launch a Jupyter Notebook, but this is the one that I like the most and use daily when I do data analysis. 👩🏻‍💻

--

--

Alice Zhao
Alice Zhao

Written by Alice Zhao

Hi! 👋 I'm a data scientist & author of the SQL Pocket Guide (O’Reilly). Check out my Data Science in Python series on Maven / Udemy & my blog, A Dash of Data.

No responses yet