To save and restore window state in iTerm2 under macOS Sonoma, follow the below steps.
-
Disable
Close windows when quitting an application
option fromSystem Preference > Desktop & Dock
under macOS Sonoma. -
In
iTerm2 > Settings > General > Start up
, chooseWindow restoration policy
:Use System Window Restoration Setting
. -
In
iTerm2 > Window > Save Window Arrangement
and specify a name. -
After launching iTerm2 and to open this arrangement in the current window use
Window > Restore Window Arrangement
and choose the name. -
To restore the window arrangement as new tab, use
Window > Restore Window Arrangement as Tabs
.
I moved to iTerm 2 because macOS Terminal is not able to display full range of colours. So the vim theme isn't working.