Skip to content

Instantly share code, notes, and snippets.

@lhstraathof
Created December 20, 2018 08:54
Show Gist options
  • Save lhstraathof/c4e53396f6fc42cc7a3b72c767ded1df to your computer and use it in GitHub Desktop.
Save lhstraathof/c4e53396f6fc42cc7a3b72c767ded1df to your computer and use it in GitHub Desktop.
Find and kill all process on a specific port on mac
# Run the following code in the terminal
# Find all processes running on a specific port (you can replace 3000 with any port):
[sudo] lsof -i :3000
# Get the PID id of the process you want to kill.
# Then with the PID id run the following command to kill it:
kill -9 <PID>
# To kill all processes on a specific port, run the following command:
lsof -ti:3000 | xargs kill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment