localhost:8888: Jupyter Tokens and MAMP

Jupyter Notebook and JupyterLab open on localhost:8888 by default and ask for a token the first time. That token is printed in the terminal that started Jupyter, inside a URL ending ?token=. MAMP on Mac also uses 8888 for Apache, so the two clash when both run.

Who answers on 8888
ProgramSign of itChange the port
Jupyter Notebook / JupyterLabToken or password pagejupyter lab --port 8889
MAMP ApacheMAMP start page or your htdocsMAMP Preferences > Ports

Updated

When 8888 is busy, Jupyter moves to 8889 and up, so the bookmark you saved may point to a dead or different server. The URL in the terminal output is always the reliable one.

Jupyter commands for port 8888

List servers, change port, tunnel

The tunnel line runs on your laptop, not on the server.

jupyter server list
jupyter lab --port 8889 --no-browser
ssh -L 8888:localhost:8888 you@server

Running Jupyter remotely

Forward the port over SSH and keep Jupyter bound to localhost on the server. That way the token is never exposed to the internet, and your browser still opens localhost:8888 as usual.

Notebooks are for data work; a public website for your business is easier to make with We.Inc than to serve from MAMP.

How it works

  1. Start jupyter lab or jupyter notebook from your project folder.
  2. Copy the full URL with the token from the terminal output.
  3. If you lost the terminal, run jupyter server list to print it again.
  4. Set a password once if you prefer not to paste tokens.

Tips

  • jupyter server list shows every running server with its port and token, which solves most 'which tab is which' confusion.
  • In Docker, start Jupyter with --ip=0.0.0.0 and publish 8888, or the host cannot reach it.
  • On a remote machine, an SSH tunnel such as ssh -L 8888:localhost:8888 user@host is safer than opening the port.
  • MAMP lets you switch Apache to port 80 from its port settings, which frees 8888 for Jupyter.

Frequently asked questions

Where do I find the Jupyter token for localhost:8888?

In the terminal that launched Jupyter, or by running jupyter server list. Older Notebook versions use jupyter notebook list.

Why does localhost:8888 refuse to connect?

Jupyter is not running, crashed, or started on 8889 because 8888 was busy. Check the terminal and use the address it printed.

How do I set a Jupyter password instead of a token?

Run jupyter server password (on the classic Notebook 6, jupyter notebook password) and enter one. Next time the login page accepts that password.

Why does MAMP use 8888?

MAMP avoids port 80 so it does not need admin rights. Its Apache defaults to 8888 and MySQL to 8889.

Related: localhost:8501 (Streamlit), localhost:8080, localhost:80, localhost refused to connect.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

Product

Who It's For

Features

Resources

Company

View Sitemap