Broken pipes on macOS

If at connecting to hosting via SSH across macOS terminal the connection is terminated after some time of inactivity, do the following:

  1. Open the SSH configuration file for editing by running the command:
    sudo nano /etc/ssh/ssh_config
  2. When prompted for a password, enter the device administrator password (no characters will be displayed on the screen when entering the password) and press Enter.
  3. At the bottom of the config file after Host * add the following lines:
    ServerAliveInterval 120
    TCPKeepAlive no

  4. Save changes with the combination +O.
  5. Close the editor with a shortcut +X.
  6. Check for a problem.

Parameter ServerAliveInterval is responsible for how often (in seconds) your PC will send a zero packet to keep the connection active. If the problem persists, try lowering the value, for example to 5... If this does not work, then it is possible that the problem is in the router used.