Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On linux I can kill a process knowing only the port it is listening on using fuser -k 9000/tcp, how do I so the same on MacOS?

share|improve this question
up vote 7 down vote accepted
lsof -P | grep ':NumberOfPort' | awk '{print $2}' | xargs kill

Change NumberOfPort to the actual port you want to search for.

share|improve this answer
I just had to add -9 to the end to get this to work, but I believe that is due to the nature of the listening application and not generally recommended practice, to kill -9 that is. – Kris Jul 24 '12 at 7:37
@Kris - lsof -P | grep ':NumberOfPort' | awk '{print $2}' | xargs kill -9 worked! – aces. Jan 18 '13 at 15:56

Add -n to lsof and you remove the reverse DNS lookup from the command and reduce the run time from minutes to seconds.

lsof -Pn | grep ':NumberOfPort' | awk '{print $2}' | xargs kill -9
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.