Stop your Mac from keeping a perpetual connection to Apple

I had done this some time ago on my laptop, but had to try to remember once again while helping someone else. I am just noting it here so it is not as difficult to remember the next time :-)

Basically, the problem is:

$ netstat -an
tcp4       0      0  192.168.xxx.xxx.52623      17.172.233.127.5223    ESTABLISHED
tcp4       0      0  192.168.xxx.xxx.52622      17.172.232.9.5223      ESTABLISHED

These connections are established as soon as the user logs in, and maintained perpetually.

$ lsof -i 4tcp
apsd    334 root    8u  IPv4 0x…      0t0  TCP 192.…:52622->17.172.232.9:5223 (ESTABLISHED)
apsd    334 root   11u  IPv4 0x…      0t0  TCP 192.…:52622->17.172.232.9:5223 (ESTABLISHED)
apsd    334 root   12u  IPv4 0x…      0t0  TCP 192.…:52623->17.172.233.127:5223 (ESTABLISHED)
apsd    334 root   14u  IPv4 0x…      0t0  TCP 192.…:52623->17.172.233.127:5223 (ESTABLISHED)

Seriously annoying.

apsd is not a rogue process or anything, but here's what the man page says:

apsd
ApplePushService daemon for Apple Push Notification service.
This is part of the ApplePushService framework.

There are no configuration options to apsd.
Users should not run apsd manually.

Well, alrighty then.

apple.stackexchange to the rescue:

$ sudo launchctl unload -w \
/System/Library/LaunchDaemons/com.apple.apsd.plist

turns it off, and,

$ sudo launchctl load -w \
/System/Library/LaunchDaemons/com.apple.apsd.plist

turns it back on.

HTH