I'm on OSX Mountain Lion 10.8.3, and I've freshly rebooted my Mac.
I want to start a service (like Apache on port 80), but there is already something going on with port 80:
telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Wait, I hear you say, you can find that with lsof or netstat. Except there is nothing there
netstat -an | grep LISTEN | grep '\.80'
*comes back blank*
lsof -i :80 | grep LISTEN
*comes back blank
So from what I know about unix systems, I figure this must be a packet forwarding rule then? I.e. packets are being forwarded from inbound port 80 to something else, which is listening on that service.
ipfw show
65535 0 0 allow ip from any to any
Hmm, nothing unusual there
pfctl -s nat
No ALTQ support in kernel
ALTQ related functions disabled
Nothing unusual there
My question is, how can I display any packet forwarding rules… On Linux I might just do iptables -L -t NAT, or iptables -L. Or alternatively, can any OSX experts help me diagnose this problem?
Best Answer
You need to run these commands as
root
to show other users' processes, for example:Mac OS X includes an Apache web server that can be controlled using
apachectl
asroot
. It's usually started vialaunchd
, the corresponding configuration file is/System/Library/LaunchAgents/org.apache.httpd.plist
. If it's not this Apache running on port 80, it is probably launchd, Apple's implementation of a daemon manager. According to Wikipedia: