Saturday, February 25, 2023

iTerm2 - How to auto-close sessions and auto-exit when last one closed

 Problem

There are two problems when you close sessions and windows in ITerm2.

When you gracefully exit from ITerm2 sessions with a recommended exit command;
  1. Closed sessions leave them dangled until you Bury them (with Bury from context menu) or close with the cross-sign  'X'  on top left. That is an extra useless step.
  2. When last session is closed iTerm2 is still left running (on the Mac menu bar.) Why not quit at the same time?
This iTerm2 window has two sessions:
Exiting from the RHS session leaves a useless pane on the right:
You can close it with the cross on the top left of the session pane, but that is an extra step.

Moreover closing the window with the last dangled session, does not close the ITerm2 app. Why not quit at the same time?

Solution

  1. To fix dangled sessions after exit, go to iTerm2 Preferences, Profiles/Session tab. Under Closing, "After a session ends" dropdown, select Close.
  2. To quit iTerm2 when last session is closed, go to iTerm2 Preferences, General/Closing tab. Tick the checkbox "Quit when all windows are closed".

No comments:

Post a Comment

iTerm2 - How to auto-close sessions and auto-exit when last one closed

 Problem There are two problems when you close sessions and windows in ITerm2. When you gracefully exit from ITerm2 sessions with a recommen...