
How to Keep SSH Connections Alive on Mac
Posted December 9, 2021 at 5:45am by iClarified
These are instructions on how to prevent timeout and keep SSH connections alive on Mac.
Step One
Launch Terminal from your Applications > Utilities folder.

Step Two
Execute the following command into the Terminal window...
sudo nano ~/.ssh/config

Enter your administrative user password when prompted.

Step Three
Add the following line to your ssh config file.
ServerAliveInterval 100

Step Four
Press Control+x to exit, then press Y when prompted to save changes.

Step Six
Press Return to confirm the filename and exit.


New SSH connections should now stay open indefinitely. You can shorten or lengthen the interval as required by your server.
Step One
Launch Terminal from your Applications > Utilities folder.

Step Two
Execute the following command into the Terminal window...
sudo nano ~/.ssh/config

Enter your administrative user password when prompted.

Step Three
Add the following line to your ssh config file.
ServerAliveInterval 100

Step Four
Press Control+x to exit, then press Y when prompted to save changes.

Step Six
Press Return to confirm the filename and exit.


New SSH connections should now stay open indefinitely. You can shorten or lengthen the interval as required by your server.
![Apple Confirms Exclusive US F1 Coverage Starts March 7, Shares First Look at Interface [Video] Apple Confirms Exclusive US F1 Coverage Starts March 7, Shares First Look at Interface [Video]](/images/news/99274/99274/99274-160.jpg)
![Apple Shares Official Trailer for 'Born to be Wild' Wildlife Series [Video] Apple Shares Official Trailer for 'Born to be Wild' Wildlife Series [Video]](/images/news/99271/99271/99271-160.jpg)
![Apple Rocked by Executive Turmoil as Chip Chief Johny Srouji Considers Leaving [Report] Apple Rocked by Executive Turmoil as Chip Chief Johny Srouji Considers Leaving [Report]](/images/news/99269/99269/99269-160.jpg)
![Apple, Google, Samsung Protest India's Mandatory Always-On Location Tracking Plan [Report] Apple, Google, Samsung Protest India's Mandatory Always-On Location Tracking Plan [Report]](/images/news/99266/99266/99266-160.jpg)
![OpenAI Accelerates GPT-5.2 Launch to Next Week Amid 'Code Red' [Report] OpenAI Accelerates GPT-5.2 Launch to Next Week Amid 'Code Red' [Report]](/images/news/99261/99261/99261-160.jpg)





![AirPods 4 With ANC Are Still On Sale for Just $99! [Lowest Price Ever] AirPods 4 With ANC Are Still On Sale for Just $99! [Lowest Price Ever]](/images/news/99264/99264/99264-160.jpg)
![Final Cyber Monday Deals: M4 MacBook Air for $749, Beats, Sonos, and More [List] Final Cyber Monday Deals: M4 MacBook Air for $749, Beats, Sonos, and More [List]](/images/news/99203/99203/99203-160.jpg)
![iPad mini 7 Falls to New All-Time Low of $349 [Cyber Monday 2025] iPad mini 7 Falls to New All-Time Low of $349 [Cyber Monday 2025]](/images/news/99197/99197/99197-160.jpg)
![Apple Watch Series 11 Drops to New All-Time Low Price of $329 [Cyber Monday 2025] Apple Watch Series 11 Drops to New All-Time Low Price of $329 [Cyber Monday 2025]](/images/news/99195/99195/99195-160.jpg)
