The terminal in question is: https://hyper.is MacOS 11.7.1 Big Sur is the operating system on a Macbook (2015). To troubleshoot this, I tried and reproduced the hang with Apple's native Terminal.app as well.

A remote connection with ssh stops responding after a short while (couple to 4 minutes) of inactivity on my computer. This doesn't happen while the power adapter is connected.

The .ssh/confing ServerAliveInterval doesn't help.

I tried to run in under screen and it still freezes.

One peculiar detail is that it keeps sending characters to remote host but doesn't show anything happening locally.

Battery options screenshot

Battery options screenshot 2

Here are screenshot from the Power options.

I can't find "Low power mode" anywhere.

It seems it's different for macbook laptops.

  • We've got some great discussions on ssh keep alive - might they be of assistance if you can't edit more details in the post? The ssh escape sequence might be of assistance as well in troubleshooting what's the cause here
    – bmike
    Commented Apr 25, 2023 at 20:24
  • 1
    Does it exhibit the sane problem with the native Terminal application?
    – Allan
    Commented Apr 30, 2023 at 15:37
  • I've reopened this, but it would be very good to know what exactly a short while is. Half a second? 4 minutes? and if it's reproducible - does it reliably freeze each and every time, basically can you make it happen. Whatever the data you've collected - sharing what is happening in specifics will help us help you and if the native terminal app works perfectly (or not) - then that's also very relevant details. Basically, you've documented not a lot of troubleshooting so far.
    – bmike
    Commented May 1, 2023 at 12:50
  • 4 minutes might be close and it happens every time with the native terminal app too. It never happens when the power adapter is connected. Commented May 1, 2023 at 17:53
  • 1
    Check your power saving settings. It’s likely you Mac is going into low power mode and disconnecting network connections.
    – Allan
    Commented May 1, 2023 at 19:44

1 Answer 1


You didn’t indicate any error message like a “broken pipe” where the server is closing the connection due to inactivity and it always happens when disconnected from mains power and while idle (no activity) on your part. This is indicative of you Mac going into a power saving mode disconnecting the network connections.

Check your Battery settings

Check Low Power Mode; set it to “Never” to ensure your Mac doesn’t go into power saving mode when there’s no activity. You’ll also want to have your computer wake for network activity “Always” rather than the default if “on Power Adapter” (Battery → Options Button)

Modify your ssh config

Edit the ~/.ssh/config file (create if necessary) to set a low value interval:

Host foo.bar
ServerAliveInterval 120

This will send a “proof of life” signal every two minutes (120 seconds) to the server. You may want to tweak this if it still disconnects.

Keep the session alive on the server (preferred)

My preferred method is to use tmux or screen to keep whatever session you’re running on the server alive in the event of a disconnect. screen is usually included with macOS or Linux, but my preference is tmux. Either of these would be installed on the server and not the client.

I (personally) don’t recommend caffeinate or similar methods to override power saving algorithms. Instead, I will use tmux because it gives me a higher degree of safety in the event of a disconnect I have no control over like the Internet going down. tmux will keep my session alive on the server which is what matters most

  • The battery setting doesn't exist here and the ssh confing doesn't help, I tried. But I'll try screen or tmux, thanks! Commented May 2, 2023 at 12:26
  • screen makes no difference, tried Commented May 2, 2023 at 13:02
  • Did you install screen on the server?
    – Allan
    Commented May 2, 2023 at 13:29
  • The question is, why does it never happen when the power adapter is connected? Commented May 2, 2023 at 17:55
  • Because your Mac doesn’t go into power save mode while connected to the mains
    – Allan
    Commented May 2, 2023 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .