October 29, 2021 by Faisal Alghurayri
Mac OS Monterey
TL;DR - Mac OS Monterey will use port 5000 for AirPlay.
If you are doing full stack web development using different tools, it is sensible that you will use multiple ports simultaneously.
I upgraded my Mac OS to Monterey while working on a Phoenix API on port 4000
and a Svelte SPA on port 5000
. After the OS upgrade is done, I was denied access to my SPA app. I felt personally attacked by being kicked out from my localhost!
Access Denied
After a quick search, the only things I found were posts from 2016 related to MySQL and using chmod
to elevate the permissions. They weren’t helpful.
To debug the issue, I had a look at the firewall and the proxy settings - they were looking fine.
Then, I looked at my /etc/hosts
file. It looked fine too.
Then, I ran the following command to see if the 5000
port was already occupied:
Port is used!
I had no idea what occupying the port was, so I opened the Activity Monitor to check the pid, but it wasn’t showing.
Then, I had to search the ControlCe
command in the web. That is when I found the topic Why is Control Center on Monterey listening on ports created 4 months ago. Finally it made sense.
Switching off the AirPlay listener solved the issue.
I hope this post helped you understand how to approach debugging local networking problems and how to fix this particular issue for Mac OS Monterey.
Take it easy,
~Faisal