To save and restore window state in iTerm2 under macOS Sonoma, follow the below steps.
-
Disable
Close windows when quitting an applicationoption fromSystem Preference > Desktop & Dockunder macOS Sonoma. -
In
iTerm2 > Settings > General > Start up, chooseWindow restoration policy:Use System Window Restoration Setting. -
In
iTerm2 > Window > Save Window Arrangementand specify a name. -
After launching iTerm2 and to open this arrangement in the current window use
Window > Restore Window Arrangementand choose the name. -
To restore the window arrangement as new tab, use
Window > Restore Window Arrangement as Tabs.
At this point, macOS Terminal is not able to display full range of colours but iTerm2 does. So vim themes doesn't work on the default terminal.