One would ask how to find and kill process on port on their Mac? Many times while developing an application, you would face the issue whereby some other processes are using the port which you require for development.
Commands to Find and Kill Process on Port Mac
The below commands find the process using port 3000 (localhost) and kills the process.
Find Process Using Port on Mac
This command finds all the processes using the port stated (e.g. 3000) and returns the Process ID.
sudo lsof -iTCP -sTCP:LISTEN -P | grep :3000
Kill Process Using Port on Mac
This command stops the process using the Process ID provided so that the port is released and can be used.
kill -9 <Process ID>
Frequently Asked Questions
How to find a process using a port on a Mac?
Use the command “sudo lsof -iTCP -sTCP:LISTEN -P | grep :<Port Number>”.
How to kill a process using a port on a Mac?
Use the command “kill -9 <Process ID>”
Have any other questions? Leave it down in the comments below or contact us !
Want more? See our Articles section!