I've discovered by accident that my Mac is running a localhost web server. I typed "localhost" into Safari and got "It works!" I get the same result when I go to

My question is: How do I turn this thing off? I've tried things like this:

$ sudo apachectl stop


$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

But this changes nothing, and the Terminal complains

/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service

I'm running Catalina. No MAMP. I did at one point a couple of years ago run npm briefly, but there is no evidence that this is its server (for one thing, it's on port 80).

Following up on Gordon Davisson's suggestion, I tried

$ sudo lsof -i | grep LISTEN

and got:

rapportd   462  mattneubelcap    4u  IPv4 0x3fcd6c7f11a6984d      0t0    TCP *:49169 (LISTEN)
rapportd   462  mattneubelcap    5u  IPv6 0x3fcd6c7f0a82c41d      0t0    TCP *:49169 (LISTEN)
cupsd     1117           root    5u  IPv6 0x3fcd6c7f0a829f5d      0t0    TCP localhost:ipp (LISTEN)
cupsd     1117           root    6u  IPv4 0x3fcd6c7f1975f0cd      0t0    TCP localhost:ipp (LISTEN)
  • 1
    What version of macOS are you running? Do you have any MAMP or MAMP PRO type of packages installed? – user3439894 Jul 4 at 19:22
  • Hi @user3439894, thanks, I've added that info at the end of the question. – matt Jul 4 at 20:18
  • 1
    Find the process IDs of the web server with sudo lsof -i :80 | grep LISTEN, then try searching the active launch daemons for the master process's PID with sudo launchctl list | grep <masterPID>. See this Q&A for an example. – Gordon Davisson Jul 4 at 20:44
  • @GordonDavisson No result on that lsof, unfortunately. – matt Jul 4 at 21:17
  • @matt That pretty much means the web server isn't running on your computer, at least under the main OS. Are you running anything like a virtual machine on the Mac? Possibly a weird firewall config that's routing traffic elsewhere? – Gordon Davisson Jul 4 at 21:53

Hidden web server

The web server running on your server is the one used by cupsd to manage your printers queue.

The command:

nmap localhost -p 80

will show you that it is actually closed, unless you activated the sharing of a printer.

You can stop cupsd either through the GUI of System Preferences… or with launchctl:

/usr/bin/sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cups-lpd.plist
/usr/bin/sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cups.plist


If you don't have nmap because your version of MacOS doesn't anymore bring this useful software (which is a total failure for people who need to analyse network problems) you can easily install it with Macports or Brew. I estimate uou will need 15 minutes to install it, read the basic documentation. Within less than half an hour you will be able to discover holes through which your system can be attacked.

| improve this answer | |
  • That's correct. There's no nmap, and System Preferences > Sharing didn't help, but System Preferences > Printers and Scanners revealed that the checkbox to share this printer was checked for my printer. Unchecking the checkbox turned off the server. Now I've turned printer sharing back on but the web server has not reappeared. At least if it does I'll know what it is! Thanks. – matt Jul 4 at 22:39
  • nmap is not a default part of macOS. – user3439894 Jul 4 at 22:40
  • Yes but it was on many previous versions. This was a good move from Apple to target a mass market of dummies. This was a stupid one for engineers, developpers, network admin, security admin. nmap is a highly useful tool and anyone with a package managment is able to install it in less than 2 minutes. @matt I suggest you to install it one day or the next it will save you many days of stupid investigations. – dan Jul 5 at 14:57
  • 1
    brew can install it. – matt Jul 5 at 15:00
  • @matt: right. I upgraded my answer for people who might'nt know tis greal tool. Since you look like a user aware of security problems, I highly advise you to install nmap and become skilled in its use. – dan Jul 5 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .