Mac Visual Studio Error: Address already in use

I have started to use the Mac version of Visual Studio more and more, and I must say I like it very much. But that does not mean it is not without its sharper edges.

Once in a while, when I am working on .NET web applications, something funky happens and when I try to run the project locally, I get the message:

Error: Address already in use

Here is how to fix this issue without having to go through some kind of insane reboot and/or ritual sacrifice.

First, find the process ID of the offending application in the terminal with this command, where you will replace 3306 with the port number that your local application runs on:

sudo lsof -iTCP -sTCP:LISTEN -P | grep :3306

This should give you the application and process ID (the first two items on the line) of the offender. Then, you enter this command, replacing 1234 with the second item from the data that the lsof command spit out:

kill -9 1234

BTW, Happy Belated 100th Birthday to the Grand Canyon. OK, not the actual canyon, but the National Park, which was designated such 100 years and 1 day ago. My advice to everyone is to stay at the El Tovar and eat breakfast at the restaurant, the sunrise is pretty astounding.

Leave a Reply