Sometimes when we start application on MacOSx or linux they don’t start, because an port is already occupied by application which terminated unexpectedly or by some other application. Developers face these kind of issue more frequently, when we run java application in our IDE eclipse or IntelliJ Idea and switch between run/debug or error in run/debug. Now we need to free the port which was occupied by an existing instance of the application or any other application, so that we can run the program again. This is a 2 step process:

1. Find applications running on a particular port

lsof -i :[port]

2. Kill application running on a port by PID we got from the previous step:
Kill -9 [PID]

Here is the screenshot:

free port on MacOSX or linux terminal

free port on MacOSX or linux terminal

Leave a Reply

Be the First to Comment!

avatar