Find and Kill HTTP Server Process Running on Port 80 or 8080 in Apple Mac OSX

I’m using a Mac to do Java development and occasionally need to kill the process running my development HTTP server on port 8080. It’s only 2 commands in the terminal.

Find the process running the HTTP server on port 8080:

lsof -n -i4TCP:8080 | grep LISTEN

Which returns something like:

java 554 myusername 62u IPv6 0xe02c342ea983a2b1 0t0 TCP *:http-alt (LISTEN)

The process ID is the second column (554 in this case), so kill the running HTTP server with:

kill 554