An SSH dynamic forward and a macOS proxy setting have different lifetimes. The SSH process provides the local SOCKS listener; the network service stores the address that participating applications should use.

For example, this keeps a loopback SOCKS listener in the foreground:

ssh -N -D 127.0.0.1:1080 [email protected]

If the selected macOS network service is configured to use SOCKS at 127.0.0.1:1080, applications using that setting depend on the listener. When the SSH process exits, the listener disappears. SSH does not automatically restore the network service’s previous proxy values.

Open the active network service’s Details → Proxies in System Settings → Network. Restore the SOCKS setting recorded before the tunnel session. If SOCKS was previously off, turn it off again; if another proxy was already configured, restore its address, port and enabled state.

Use that same service when checking the result. Wi-Fi and Ethernet can have different proxy settings, and an application with its own proxy configuration needs its own corresponding change. A shell command placed after ssh is a separate cleanup action, so do not mistake a normal exit sequence for a guarantee that every interrupted session restores the original state.

Winndannde jowitiiɗe heen