I need to use the port 5000 with flask but it seems to be already in use by some process.
This is my output when I run sudo lsof -i:5000
:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 1897 manu 32u IPv4 0x4ab7b80aa5149af7 0t0 TCP *:commplex-main (LISTEN)
ControlCe 1897 manu 32u IPv4 0x4ab7b80aa5149af7 0t0 TCP *:commplex-main (LISTEN)
Whenever I try to kill the process by running kill -9 $PID
it restarts immediately.
I don't know what this process is and why is occupying the port 5000.
Of course I could set flask to use another port but I would really like to know what this process is and why I can't kill it.
CodePudding user response:
macOS Monterey has a new feature called "AirPlay Receiver" that uses port 5000. You can disable this feature in System Preferences -> Sharing -> AirPlay Receiver. After this, you should find port 5000 free again.