I am having an issue keeping ssh connections alive on macOS Monterey when using battery. whenever the screen shuts down or I manually lock the screen all connections stop and upon resuming my ssh session is frozen and I have to reconnect again.

I have tried all options in battery settings but to no success, it keeps shutting down any connection have instantly

I am running an m1 pro 16" macbook, if that's useful info

  • In System Preferences > Battery, is the option "Low power mode" enabled in the "Battery" section? If it is, could you disable it and test?
    – jaume
    Jul 31 at 12:16
  • 1
    @jaume nope it's not up Jul 31 at 14:05
  • How long do you leave it before resuming, seconds, minutes? Jul 31 at 16:21
  • 1
    I know that ssh apps on iOS do something similar, Prompt 2 on my old iPad will disconnect, but I think that's more an accepted behaviour for an iOS app. I tried a battery only ssh on my M1 MBP (12.5) and shut the lid for a few minutes. The ssh session survived running top on the remote side, indicating the MBP didn't enter a proper sleep. Nothing showed in pmset on the MBP, though not my area of expertise. Sorry I can't help further, but if you want to avoid some of the hassle of the disconnect you could consider using tmux or similar on the remote so that you have a resumable session. Aug 1 at 12:00
  • 1
    See also the highest scored answer re. ssh timeouts for this question. apple.stackexchange.com/questions/251221/… Also, is there anything special about the ssh server configuration on the remote which may be contributing to a timeout? Aug 1 at 12:23


You must log in to answer this question.

Browse other questions tagged .