What’s running on port 8000 on my Mac?
8000 is the Python and PHP world’s 3000. Django, FastAPI, Laravel and Python’s built-in file server all start there, and the last one shares your folder with the whole network by default.
Updated
Commonly used by
- Django
python manage.py runserverserves on 127.0.0.1:8000. - FastAPI / uvicorn
fastapi devanduvicorn main:appdefault to 127.0.0.1:8000. - Laravel
php artisan serveruns PHP’s built-in server on 127.0.0.1:8000. - python -m http.serverServes the current folder on port 8000, on every interface.
- Gatsby / MkDocs
gatsby developandmkdocs servealso use 8000.
Check what’s on port 8000
lsof -nP -iTCP:8000 -sTCP:LISTEN
ps -o pid,etime,command -p <PID>
The full command line separates the usual suspects:
| Command line contains | Tool |
|---|---|
manage.py runserver | Django |
uvicorn / fastapi | FastAPI or another ASGI app |
php -S or artisan serve | Laravel / PHP built-in server |
http.server | Python’s file server |
node … gatsby | Gatsby |
Django’s autoreloader runs two Python processes; the child holds the port, and killing the parent stops both.
With Stat Space: statspace port 8000.
Change the port
| Tool | Command |
|---|---|
| Django | python manage.py runserver 8001 |
| FastAPI | fastapi dev main.py --port 8001 or uvicorn main:app --port 8001 |
| Laravel | php artisan serve --port=8001 |
| Python file server | python3 -m http.server 8001 --bind 127.0.0.1 |
| Gatsby | gatsby develop -p 8001 |
| MkDocs | mkdocs serve -a 127.0.0.1:8001 |
Laravel will try 8001, 8002 and so on by itself if 8000 is busy. Django and uvicorn fail instead.
Who can reach it
Django, uvicorn and artisan bind to 127.0.0.1 by default, so they’re local unless you pass 0.0.0.0:8000 or --host 0.0.0.0. Two exceptions catch people out:
python3 -m http.serverlistens on all interfaces. Run it in your home folder and anyone on the network can browse your files. Always add--bind 127.0.0.1.- Django with
DEBUG = Trueon0.0.0.0shows full tracebacks with settings and environment details to anyone who triggers an error.
Check with lsof: *:8000 means reachable from the network. More in dev server exposed to the network.
Seeing it live
Stat Space shows 8000 with the framework it detected (Django and other common ones), the project folder and the launcher, and flags *:8000 bindings such as a forgotten http.server in your home folder.
Questions
How do I run Django on a different port?
Pass it as an argument: python manage.py runserver 8001. For another address too: python manage.py runserver 127.0.0.1:8001.
Why does Django say 'That port is already in use'?
Another runserver (often from another project or a crashed terminal) still holds 8000. Find it with lsof -nP -iTCP:8000 -sTCP:LISTEN and stop it with kill <PID>.
Is python -m http.server safe to use?
It's fine for local testing, but it binds to all interfaces and serves every file under the folder you ran it from. Add --bind 127.0.0.1 to keep it on your Mac.
Know what your Mac is doing, without adding to it.
Free, no account. Pro is $9.99 once for the first 100 buyers.