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;
- 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.
- 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
- To fix dangled sessions after exit, go to iTerm2 Preferences, Profiles/Session tab. Under Closing, "After a session ends" dropdown, select Close.
- To quit iTerm2 when last session is closed, go to iTerm2 Preferences, General/Closing tab. Tick the checkbox "Quit when all windows are closed".