Address already in use: Rails, Spring Boot, Go, .NET, PHP¶
Whatever the language, the fix is the same: find what holds the port, then stop it or use another port.
portcheck shows the process and who started it, asks, stops it gently first, and never
touches system processes. Install it with brew, npm, pipx or Scoop to drop the
npx (see Install).
Ruby on Rails (Puma)¶
An old rails server is still running: portcheck kill 3000.
This one can be a stale PID file left by a crash. Check whether anything is really on the port:
If it says the port is free, delete tmp/pids/server.pid and start again.
Java and Spring Boot¶
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8080 was already in use.
Plain Java reports java.net.BindException: Address already in use. Often the holder
is an earlier run from your IDE that is still alive: portcheck kill 8080 shows it as
java, started by idea or your terminal. In IntelliJ IDEA, the
portcheck plugin catches this in the Run window and offers
Stop and rerun.
Go¶
go run builds a binary in a temporary folder, so the holder often has a random name
like main or __debug_bin. portcheck's started by (go ← zsh, or dlv for the
debugger) tells you where it came from.
ASP.NET Core (Kestrel)¶
On macOS, port 5000 is often AirPlay Receiver; see
the macOS note. Otherwise, it's usually an earlier
dotnet run: portcheck kill 5000.
PHP built-in server¶
portcheck kill 8000, or start on a free port:
portcheck run --port 8000 --next -- php -S localhost:{port}.