OSX ssh server disconnects after 15 minutes I have a Mac mini running MacOS Sierra, with Remote Login turned on. I can ssh into the mini just fine (Cygwin's SSH client), but if I issue a long-running command (e.g. building clang from source) it doesn't complete, because the ssh connection gets disconnected. This is the end of the output of the ssh client when invoked with the -vvv switch:

debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i0/0 o0/0 fd 4/5 cc -1)

Connection to mini11 closed by remote host.
Connection to mini11 closed.
Transferred: sent 3712, received 129732 bytes, in 735.3 seconds
Bytes per second: sent 5.0, received 176.4
debug1: Exit status -1


I tried running the build command from caffeinate -i, but it didn't seem to help. What now?

Every OS/X SSH article I found was about OS/X SSH client being disconnected.
You should be able to force the client to send keepalive messages if there is no activity by setting TCPKeepAlive yes (should be default) in ssh_config.

If it will not help, you can try to set

ServerAliveCountMax 5
ServerAliveInterval 600 # seconds = 10 minutes