Put this helper funciton in your ~/.zshrc
or ~/.bash_profile
:
release_port() {
pid=$(lsof -ti:$1)
if [ -z $pid ]; then
echo "Nothing is running on port $1"
else
kill $pid
echo "Killed process on port $1 with pid $pid"
fi
}
Use it like
release_port 3030