macOS Monterey Port 5000

Find the Process ID (PID) Using lsof

Type the code below in your terminal and replace <port-number> with the port you want to find

lsof -nP -iTCP -sTCP:LISTEN | grep <port-number>
lsof -nP -iTCP -sTCP:LISTEN | grep 5000
node 63851 pogo 27u IPv6 0xfded4774db1c601f 0t0 TCP *:5000 (LISTEN)

Find the Process ID (PID) Using netstat

Using the nestat command we can find the process ID (PID) for a specific port. In the terminal replace “<port-number>” with our port number.

netstat -anv | grep <port-number>
netstat -anv | grep 5000
tcp46 0 0 *.5000 *.* LISTEN 131072 131072 63851 0 0x0100 0x00000106

Find the Process Name

We can now use the process status command ps to display the process name for the process ID (PID).

ps -Ao user,pid,command | grep -v grep | grep <PID>

How to stop ControlCenter from using port 5000?

The process running on this port turns out to be an AirPlay server. You can deactivate it in System Preferences › Sharing, and unchecking AirPlay Receiver to release port 5000.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Luis Castillo

Luis Castillo

Software Engineer / Full-Stack Developer in Ruby, Ruby on Rails, JavaScript, ReactJS, Redux, SQL, HTML5, CSS3