Max Kreutzfeldt

March 04, 2024

Terminate running process on port

A little helper for the mac terminal, when a port is already used by another running process. I face this issue in rare cases by using npm run dev a lot on several project at the same time. In the example below, the port number equals 6006 and the PID (process ID) counts 81977.

# 1. list running process on the port to get 'PID'lsof -i:6006# 2. use listed 'PID' to terminate the running process kill -9 81977# 3. check again that process does not get listed and is terminatedlsof -i:6006