Managing Stuck Servers on macOS
Quickly Free Up Ports and Kill Stuck Processes on macOS
If your server seems stuck or unresponsive, or maybe its telling you there is already a process running but you cant seem to find and shut it down, here’s a quick few-step process to identify and kill the process blocking the port: Find the process using the port:
lsof -i tcp:3000
This will list all processes using port 3000 and show their process IDs (PIDs). If you are on a different port, just change 3000 to whatever number you need to check. Stop the process:
To allow the process to terminate gracefully try:
kill -15 [PID]
If this doesn’t seem to do anything helpful try:
kill -2 [PID]
And if that doesn’t seem to be helping you can use the last resort of:
kill -9 [PID]
Replace [PID] with the actual process ID from step 1. Just a warning, the -9 flag sends a SIGKILL signal, immediately stopping the process without cleanup. This can lead to file corruption and seems to be generally viewed as a bad practice unless nothing else seems to be working. By following these steps, you can resolve server conflicts and free up your port for development. Here are some articles that have influenced this blog post and can provide more information for deeper learning:
- https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process
- https://askubuntu.com/questions/184071/what-is-the-purpose-of-the-9-option-in-the-kill-command
- https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process https://porkmail.org/era/unix/award#uuk9letter
If you’re looking for a team to help you discover the right thing to build and help you build it, get in touch.
Published on September 24, 2025