Port 6006

What’s running on port 6006 on my Mac?

Two very different tools share 6006: Storybook for UI components and TensorBoard for machine learning runs. Either way, lsof tells you which in one line.

Commonly used by

  • Storybooknpm run storybook runs storybook dev -p 6006.
  • TensorBoardtensorboard --logdir runs serves on localhost:6006.

Check what’s on port 6006

lsof -nP -iTCP:6006 -sTCP:LISTEN
COMMANDTool
nodeStorybook
Python / python3.xTensorBoard

Check the folder to see which repo or experiment it belongs to:

lsof -a -p <PID> -d cwd -Fn | tail -1

With Stat Space: statspace port 6006.

Free it

Ctrl-C in the terminal that started it, or kill <PID>. TensorBoard started from a Jupyter notebook with %tensorboard keeps running after the cell finishes; list them with tensorboard.notebook.list() or just kill the process.

Change the port

Storybook, one-off:

npm run storybook -- -p 6007

Or change the script in package.json:

"storybook": "storybook dev -p 6007"

TensorBoard:

tensorboard --logdir runs --port 6007

In a notebook: %tensorboard --logdir runs --port 6007.

Who can reach it

Run lsof and look at the address. If you see *:6006, the server accepts connections from every device on the network.

  • Storybook prints an “On your network” URL when it listens on all interfaces. Use storybook dev -p 6006 --host localhost to keep it on your Mac. A published Storybook is harmless, but a dev one can expose unreleased designs and mock API data.
  • TensorBoard binds to localhost by default. --bind_all or --host 0.0.0.0 opens it up; it has no login, and it shows your training data samples, hyperparameters and file paths.

See dev server exposed to the network.

Seeing it live

Stat Space lists 6006 with the project folder and launcher behind it, how long it’s been running, and whether it’s on *:6006. A Storybook you started last week from another repo is easy to spot and stop.

Questions

What happens if 6006 is taken when I start Storybook?

Storybook asks whether to use another port, then picks the next free one. Pass --exact-port if you'd rather it fail.

How do I run TensorBoard on another port?

Use tensorboard --logdir runs --port 6007. Add --bind_all only if another machine needs to reach it.

Why does Storybook show 'On your network' URL?

It's telling you the dev server accepts connections from your LAN. Pass --host localhost if you want it local-only.

Get started

Know what your Mac is doing, without adding to it.

Free, no account. Pro is $9.99 once for the first 100 buyers.