What are the correct commands to close ports in macOS 26?

I read different instructions to close ports in macOS coming from seemingly questionable sites. For example, I see from China coming often. I then close the port, but later I see it coming again.


The instructions on google and apple community are: sudo lsof -i: (Port Number). Then another one as sudo lsof -i :(Port Number).


I don't know which one is correct, if at all. Is there something else? I need to learn how to identify services to close ports I don't need services for.


The choices given to identify the macOS is not updated so I chose MacOs Sequoia.


Can someone help?

Thank you.


[Edited by Moderator]

Original Title: closing ports in macos 26

Posted on Oct 20, 2025 3:33 PM

Reply
4 replies

Oct 20, 2025 6:48 PM in response to CyberSquirrel-9

Unless you have any of the Sharing services enabled, you have no ports open except those that must be open.

For instance, you can't close port 80 because then you wouldn't get any responses from your web requests.

Do you have a WiFi router or is your Mac directly connected to the internet? If you have a router, nothing on the internet can contact you Mac unless you initiate the request (e.g., web browser asking for a page).

Oct 20, 2025 4:37 PM in response to CyberSquirrel-9

man lsof -i

indicates that lsof is a command to list open files, and that the flag in question "selects the listing of files any of whose Internet address matches the address specified … if no address is specified, this option selects the listing of all Internet and x.25 (HP-UX) network internet files."


So I don't think the commands suggested by those sites close anything.

Oct 20, 2025 6:49 PM in response to CyberSquirrel-9

Most people use a computer that is already hidden behind a firewall which should by default block most Internet requests from the outside world. Besides the router's firewall, most people use their computer on a NAT'ed network which give the devices on your home network a private IP address that is not directly accessible from the outside world unless someone has customized or hacked your router's default firewall settings to allow traffic to pass through the router's firewall.


You need to forget worrying about macOS since macOS already has great built-in security with default settings as long as the user also practices safe computing habits as outlined in this excellent article:

Effective defenses against malware and other threats - Apple Community



You should worry more about your router instead since most consumer grade routers are pure junk even when properly configured (this includes some of the more "respected" name brands). You definitely want to keep your router's firmware up to date and make sure to disable any remote management of the router from outside your local network (it should be the default setting, but I always check since the router manufacturers have a poor track record).


Edit: @Barney-15E makes a great point about the Sharing services & Remote Management.

Oct 20, 2025 9:12 PM in response to CyberSquirrel-9

CyberSquirrel-9 wrote:

I read different instructions to close ports in macOS coming from seemingly questionable sites. For example, I see from China coming often. I

[Edited by Moderator]
Original Title: closing ports in macos 26


Questionable sites(?) You say little for all your concern here.



I suspect this is normal business as usual, Apple use many severs / IP's routed via China.


cloud providers around the world AWS, Azure —Apple uses both.


ref: rtcreportingd connecting to non-apple ser… - Apple Community


ref: TCP and UDP ports used by Apple software products - Apple Support






This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

What are the correct commands to close ports in macOS 26?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.