THE FOUNDER’S GUIDE

How to Install the Jupyter Notebook Server on Mac

The expanded tutorial with concise explanations and screenshots

David Littlefield
Mac O’Clock

--

Image by Vita Vilcina

“The condensed version of this article uses copy and paste code to help you get the outcome ASAP ⚡”

Open Terminal:

The Terminal is a program that’s included with macOS that provides users with access to the operating system using a command-line interface. It uses Z shell by default which replaced Bourne Again Shell as the system shell. It can also work with other shells like Korn, Tenex C, and Bourne Again Shell.

  1. Press “Command ⌘ + Spacebar”
  2. Enter “Terminal”
  3. Press “Return”

Install Jupyter Notebook:

Jupyter Notebook is a program that’s used to create, modify, and distribute notebooks that contain code, equations, visualizations, and narrative text. It provides an interactive coding environment that runs in the web browser. It also has become a preferred tool for machine learning and data science.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python -m pip install jupyter

Install the WebSocket Extension:

WebSocket Protocol is a protocol that’s used to establish and maintain the connection between the web browser and server without being blocked by the same-origin policy. It passes HTTP traffic through the designated port which allows the web browser to access the hardware over the internet.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python -m pip install jupyter_http_over_ws

Create the Configuration File:

The Configuration File is a Python file that’s used to customize the Jupyter Notebook server. It gets generated with every possible server parameter, option, and setting already included but they’re commented out by default. It also gets stored in the hidden .jupyter subdirectory of the home directory.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
jupyter notebook --generate-config

Open the Jupyter Directory:

The Change Directory (cd) command is used to change the current working directory to the specified directory. It can navigate to absolute and relative paths that start from the root and current working directory, respectively. It can also navigate to paths stored in variables and environment variables.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
cd $HOME/.jupyter

Create the Self-Signed Certificate:

The Req command is used in OpenSSL to generate and process certificate requests. It can be combined with the x509 command to produce a self-signed certificate. It can also be used to produce a non-encrypted private key with maximum strength encryption that’s valid for up to 825 days.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Enter”
  4. Enter “US” into “Country Name”
  5. Press “Enter”
  6. Enter “.” into the remaining fields
  7. Press “Enter”
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem

Create the JSON File:

The Echo command is used to print text it receives from the argument to the screen or to a computer file. It can be used in shell scripts and batch files to print the output of other commands or as part of other commands to insert text. It can also overwrite the text in an existing file or append it at the end.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
echo "" >> jupyter_notebook_config.json

Open the JSON File:

JavaScript Object Notation (JSON) is a file format that’s used to store and transfer data on the internet. It can convert data into human and machine-readable text that’s parsable by most programming languages. It can also contain key-value pairs of strings, numbers, booleans, arrays, and objects.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
open -a textedit jupyter_notebook_config.json

Edit the JSON File:

The Configuration File is a JSON file that’s used to customize the Jupyter Notebook server. It only contains server parameters, options, and settings that are specified by the user which receive priority over the Python file. It also gets stored in the hidden .jupyter subdirectory of the home directory.

  1. Copy the code from below these instructions
  2. Paste the code into TextEdit
  3. Change “Admin” to the Mac username
  4. Click the “File” menu
  5. Click “Save”

Create the Password:

Jupyter Notebook uses token-based authentication to restrict access to the server. This creates a problem because the server runs in the background at startup so the token isn’t visible. It also alternatively uses password-based authentication which provides a secure way to access the server remotely.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
jupyter notebook password

Open the Launch Agents Directory:

The Change Directory (cd) command is used to change the current working directory to the specified directory. It can navigate to absolute and relative paths that start from the root and current working directory, respectively. It can also navigate to paths stored in variables and environment variables.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
cd $HOME/library/launchagents/

Check the Executable File:

The Which command is used to identify the location of the executable file for the specified command name. It searches for the executable file in the list of directories from the PATH environment variable. It also displays the absolute path of the executable file if it exists in the one of the directories.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
  4. Write down the Jupyter Notebook path
which jupyter-notebook

Create the Plist File:

The Echo command is used to print text it receives from an argument to the screen or to a computer file. It can be used in shell scripts and batch files to print the output of other commands or as part of other commands to insert text. It can also save over the text in an existing file or append it at the end.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
echo “” >> com.jupyter.notebook.plist

Open the Plist File:

The Property List (plist) is an XML file that’s used to save user preferences for macOS and iOS programs. It organizes the data into a dictionary with key value pairs. It can also only store certain types of data which includes strings, numbers, binary data, dates, booleans, arrays, and dictionaries.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
open -a textedit com.jupyter.notebook.plist

Edit the Plist File:

The property list is used to start the Jupyter Notebook server at startup. It mostly combines the “Keep Alive” and “Run at Load” properties to execute the program that’s listed in the “Program Arguments” property. This runs right as the user logs into the system and it stays running until they log out.

  1. Copy the code from below these instructions
  2. Paste the code into TextEdit
  3. Change “Admin” to the Mac username
  4. Replace the Jupyter Notebook path
  5. Click the “File” menu
  6. Click “Save”

Open Full Disk Access:

Full Disk Access is a security feature that’s used on MacOS to prevent third-party applications from interacting with private data without authorization. It allows an application to access the files, directories, and certain settings on the computer which includes its Desktop, Documents, and Downloads.

  1. Click the “” menu
  2. Click the “System Preferences” menu item
  3. Click the “Security & Privacy” button
  4. Click the “Privacy” tab
  5. Select “Full Disk Access”

Enable Full Disk Access for Zsh:

Z Shell (Zsh) is an interactive shell that’s used as a login shell and command interpreter for shell scripting. It provides an extended version of Bourne Again Shell which contains features from Bourne Again Shell, Korn, and Tenex C. It also includes many original features like plugins and themes.

  1. Click the “🔒” button
  2. Enter the password
  3. Click “Unlock”
  4. Click the “+” button
  5. Press the “⌘ Command” + “Shift” + “.” keys
  6. Click “Macintosh HD”
  7. Click the “Bin” directory
  8. Click the “Zsh” file
  9. Click “Open”

Get the Private IPv4 Address:

The Internet Protocol Configuration (ipconfig) command is used to display the Transmission Control Protocol / Internet Protocol values. It prints the IPv4 address, subnet mask, default gateway, and domain name system addresses for all the physical and virtual network adapters on the computer.

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
  4. Write down the private IPv4 address
ipconfig getifaddr en0

Log into the Router:

The Router is a network device that transfers data between the internet and computers on the local network. It uses a firewall to protect computers from attackers by restricting network traffic based on a set of security rules. This can be set up by visiting the router IP address which varies by manufacturer.

  1. Open the web browser
  2. Copy the router IP address from below these instructions
  3. Paste the router IP address into the web browser
  4. Press “Enter”
  5. Log into the router
192.168.0.1

Set up Port Forwarding:

Port Forwarding is a router feature that’s used to let computers on a local network interact with other computers over the internet. It intercepts the incoming traffic on a specified port number. It also redirects the traffic to the specified private IP address and port number of a particular computer.

  1. Find the “Port Forwarding” page
  2. Paste the IPv4 address into the “Enter IP Address” text field
  3. Copy the port from below these instructions
  4. Paste the port into the “WAN Starting Port” text field
  5. Paste the port into the “WAN Ending Port” text field
  6. Select “All IP Addresses”
  7. Click “Apply”
8886

Get the DNS Servers:

The Domain Name System (DNS) is a service that converts human-readable domain names into public IP addresses. It stores domain names and public IP addresses in databases on servers. It looks up the domain names that are requested by users and uses the public IP address to route them to the site.

  1. Click the “Apple” menu
  2. Click “System Preferences”
  3. Click “Network”
  4. Click “Advanced”
  5. Click “DNS”
  6. Write down the DNS IP addresses

Set the Static IP Address:

The IPv4 Address is a unique IP address that’s used to access the internet and computers on the local network. It can be used as a public IP address which provides access to the internet. It can also be used as a private IP address which provides access to other computers on the local network.

  1. Click the “TCP/IP” tab
  2. Set “Configure IPv4” to “Manually”
  3. Enter the private IP address from earlier

Set the DNS Servers:

The Domain Name System (DNS) is a service that converts human-readable domain names into public IP addresses. It stores domain names and public IP addresses in databases on servers. It looks up the domain names that are requested by users and uses the public IP address to route them to the site.

  1. Click the “DNS” tab
  2. Click the “+” button in DNS Servers
  3. Enter the DNS IP addresses from earlier
  4. Click “OK”
  5. Click “Apply”
  6. Restart the computer

Access the Server From the Local Network:

The warning appears in the web browser because the SSL certificate isn’t verified by a certificate authority. It warns users to proceed with caution because it can’t confirm the identity of the website owner. This happens because the certificate is self-signed but it offers the exact same protection.

  1. Log into a different computer or laptop
  2. Connect to the same WiFi network
  3. Enter the IPv4 Address into the web browser
  4. Prepend “https://” to the IP address
  5. Append “8886” to the IP address
  6. Press “Enter”
  7. Type “thisisunsafe”
  8. Enter the password
  9. Click “Log In”

Get the Public IP Address:

The Public IP Address is a unique IP address that’s assigned to the router by an internet service provider. It gets shared between the computers on the local network which allows them to access the internet. It also gets used to access computers on the local network from computers over the internet.

  1. Copy the URL from below these instructions
  2. Paste the URL into the web browser
  3. Write down the public IP address
https://www.google.com/search?q=whatsmyip

Access the Server From a Remote Network:

The warning appears in the web browser because the SSL certificate isn’t verified by a certificate authority. It warns users to proceed with caution because it can’t confirm the identity of the website owner. This happens because the certificate is self-signed but it offers the exact same protection.

  1. Log into a different computer or laptop
  2. Connect to a different WiFi network
  3. Enter the public IP address into the web browser
  4. Prepend “https://” to the IP address
  5. Append “8886” to the IP address
  6. Press “Enter”
  7. Type “thisisunsafe”
  8. Enter the password
  9. Click “Log In”

“Hopefully, this article helped you get the 👯‍♀️️🏆👯‍♀️, remember to subscribe to get more content 🏅”

Next Steps:

This article is part of a mini-series that helps readers set up everything they need to start learning about artificial intelligence, machine learning, deep learning, and or data science. It includes articles that contain instructions with copy and paste code and screenshots to help readers get the outcome as soon as possible. It also includes articles that contain instructions with explanations and screenshots to help readers learn about what’s happening.

Linux:
01. Install and Manage Multiple Python Versions
02. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
03. Install the Jupyter Notebook Server
04. Install Virtual Environments in Jupyter Notebook
05. Install the Python Environment for AI and Machine Learning
WSL2:
01. Install Windows Subsystem for Linux 2
02. Install and Manage Multiple Python Versions
03. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
04. Install the Jupyter Notebook Server
05. Install Virtual Environments in Jupyter Notebook
06. Install the Python Environment for AI and Machine Learning
07. Install Ubuntu Desktop With a Graphical User Interface (Bonus)
Windows 10:
01. Install and Manage Multiple Python Versions
02. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
03. Install the Jupyter Notebook Server
04. Install Virtual Environments in Jupyter Notebook
05. Install the Python Environment for AI and Machine Learning
Mac:
01. Install and Manage Multiple Python Versions
02. Install the Jupyter Notebook Server
03. Install Virtual Environments in Jupyter Notebook
04. Install the Python Environment for AI and Machine Learning

Glossary:

The Shell is an interpreter that presents the command-line interface to users and allows them to interact with the kernel. It lets them control the system using commands entered from a keyboard. It also translates the commands from the programming language into the machine language for the kernel.
[Return]

The Interpreter is a program that reads through instructions that are written in human-readable programming languages and executes the instructions from top to bottom. It translates each instruction to a machine language the hardware can understand, executes it, and proceeds to the next instruction.
[Return]

The Command-Line Interface (CLI) is a program that accepts text input from the user to run commands on the operating system. It lets them configure the system, install software, and access features that aren’t available in the graphical user interface. It also gets referred to as the terminal or console.
[Return]

The Kernel is the program at the heart of the operating system that controls everything in the computer. It facilitates the memory management, process management, disk management, and task management. It also facilitates communication between the programs and hardware in machine language.
[Return]

The Same-Origin Policy is a security feature that’s used in web browsers to stop websites from running malicious scripts on other websites. It disables cross-domain communication over HTTP which also blocks web browsers from accessing the hardware on the computer that’s running the server.
[Return]

The Variable is the container that’s used to store different types of values. It can assign or update a value by placing an equals sign between the specified variable name and value without a space around it. It can also reference the stored value by placing a dollar sign in front of the existing variable name.
[Return]

The Environment Variable is a variable that’s automatically created and maintained by the computer. It helps the system know where to install files, find programs, and check for user and system settings. It can also be used by graphical and command-line programs from anywhere on the computer.
[Return]

OpenSSL is a program that’s used to implement the Secure Socket Layer. It can generate private keys, create certificate signing requests, produce self-signed certificates, and validate certificate information. This can be used to help identify website owners and protect sensitive user data from attackers.
[Return]

The Secure Socket Layer (SSL) is the security protocol that adds a layer of protection to sensitive data using key pairs. It stores the private key on the server and distributes the public key to web browsers. It uses the keys to establish an encrypted connection between the web browser and the server.
[Return]

The Self-Signed Certificate is a certificate that’s used to identify the owner of a website. It can be signed by the same person or company that produced the certificate instead of a certificate authority. It can also provide the same level of protection as certificates that are signed by a certificate authority.
[Return]

Token-based Authentication is a practice that’s used to authorize users that attempt to access the server using a token that’s provided by the server. It creates a token and only grants access to users that have that token. It also allows web browsers to store and reuse the token until the server is reset.
[Return]

Password-based Authentication is a practice that’s used to authorize users that attempt to access the server using a password that’s provided by the user. It hashes and stores the password and only grants access to users that have that password. It also lets web browsers store and reuse the password.
[Return]

Hashing is a process that’s used to perform a transformation to a password that can’t be reversed. It turns the password into a short string of letters and numbers using a hashing algorithm. This makes it harder for an attacker to use a hashed password because they still must decode it for it to be useful.
[Return]

The Transmission Control Protocol / Internet Protocol is an internet protocol suite that enables computers to exchange information over the internet. It defines how the information is broken down into packets, addressed, sent, routed, received, and reassembled successfully without errors or omissions.
[Return]

The Transmission Control Protocol (TCP) is a protocol that’s used to break data into packets to be sent over the internet. It numbers the packets and reassembles them in order before handing them to the recipient computer. It also checks for errors, omissions, and requests missing data to be resent.
[Return]

The Internet Protocol (IP) is a protocol that’s used to deliver packets over the internet to IP addresses. It assigns a unique IP address to each device that’s connected to the internet which lets them send and receive packets. It also routes the packets from the source IP address to the destination IP address.
[Return]

The Packet is a small piece of data that’s been broken down to be sent over the internet. It contains two portions which includes the actual data that’s being sent and the metadata that’s used to send, receive and reassemble it. It also gets sent through whichever routes and file orders are most efficient.
[Return]

The Wide Area Network (WAN) is a network that’s used to transmit data between computers on different networks that are separated by great distances. It contains a network of local area networks that spans across large geographic areas like cities, states, countries, and even the world.
[Return]

The Local Area Network is a network that’s used to transmit data between computers on the same network that are located in the same physical area. It contains a network of computers and peripheral devices that are limited to geographic areas like homes, schools, laboratories, and office buildings.
[Return]

--

--

David Littlefield
Mac O’Clock

From: Non-Technical | To: Technical Founder | Writes: To Make It Easier For Everyone | Topics: #Startups #How-To #Coding #AI #Machine Learning #Deep Learning