Port 6379 already in use on Mac? Fix Redis
redis-server stops with “Could not create server TCP listening socket *:6379”. A Redis is already running on your Mac. Often that’s fine and you can just use it; otherwise find where it came from and stop it there.
By Anmol Sethi · Updated
In short
Check with redis-cli ping: PONG means a Redis is already up and you may not need a second one. To stop it, find it with lsof -nP -iTCP:6379 -sTCP:LISTEN, then use brew services stop redis for Homebrew or docker stop <container> for Docker. A Redis you started by hand stops with redis-cli shutdown. To run two, start the second with redis-server --port 6380.
The error
# Warning: Could not create server TCP listening socket *:6379: bind: Address already in useDocker’s version is Bind for 0.0.0.0:6379 failed: port is already allocated: here, a local Redis has the port the container wants.
First: maybe just use the running one
redis-cli ping
redis-cli info server | grep -E 'exec|config_f'PONG means it works. executable and config_file show where it came from. If it’s Homebrew’s Redis that starts with your Mac, your app can usually just connect to it on localhost:6379.
Find and stop it
lsof -nP -iTCP:6379 -sTCP:LISTEN
ps -o pid,etime,command -p <PID>| It’s | How to tell | Stop it with |
|---|---|---|
| Homebrew | Path in /opt/homebrew/ or /usr/local/; brew services list shows redis started | brew services stop redis |
| Docker | The holder is com.docker or OrbStack | docker ps --filter publish=6379, then docker stop <container> |
| Started by hand | redis-server with no service, often with --daemonize yes | redis-cli shutdown |
| Valkey | valkey-server | brew services stop valkey |
Don’t use redis-cli shutdown or kill on Homebrew’s Redis: its service starts it straight back. brew services stop stops it and keeps it from starting at login.
redis-cli shutdown saves to disk first if saving is turned on. To stop without saving, redis-cli shutdown nosave.
Run a second Redis on another port
redis-server --port 6380
redis-cli -p 6380 pingIn Docker, publish it elsewhere: -p 6380:6379. Then point the app at it, for example REDIS_URL=redis://localhost:6380.
The one-click way: Portlivo
Portlivo shows Redis and Valkey from Homebrew or a Docker container as a named row in the menu bar, marked as a database. Stop uses brew services stop or docker stop, so the service doesn’t bring it straight back, and Restart restarts it through its service.
Questions people ask
- Why does Redis come back after I kill it?
- Homebrew’s service keeps it running and restarts it when it exits. Stop it with
brew services stop redisinstead. - Do I need to stop Redis to fix this?
- Not if the running one is the Redis you want. Check with
redis-cli pingand connect your app to it. Stop it only if it’s a different version or setup.
Try Portlivo free for 7 days. Every feature, no account.Then $8.99 once, no subscription.
Download for MacSend to my MacStill have a question?
Write to us — a real developer reads every email and replies personally.