
As a developer, whenever you have the need to restart your machine, everyone would want to resume from where we left. Most apps like web browsers, code editor support restoring all tabs or windows after a restart but terminal in the past have not been great. Even if terminals have added support at a later point, developer have got used to the fact we have to start from scratch. So whether restore works or not, I really didn’t care for many yeats. But recently, I have enjoyed the restore tabs/windows feature even in terminal.
When I set up iTerm2 on a new machine, it didn’t work. So I was looking into iTerm2 settings but it wasn’t working. That’s when I realized macOS and iTerm2 offer different ways to restore your previous session.
Reopen iTerm2 Windows Using macOS settings
MacOS has the settings “Close windows when quitting an application” in System Settings -> Desktop & Dock -> Windows -> “Close windows when quitting an application”. By default this is disabled. Since iTerm’s default window restoration policy was set to “use system settings”, windows wasn’t getting restored after quitting the app.
This system settings is macOS’s built-in restore feature, which will ensure it reopens all your previous iTerm2 windows. Once you enable “Close windows when quitting an application” in system settings, windows in iTerm will be restored, as is, in the same state, before quitting the app.


On top of this there are other settings in iTerm2. One among that is under General -> Window -> “Remember the size and position of previously closed windows”. This is optional since macOS takes care of this.

iTerm2 also provides automatic restoration every time, enable Preferences → General → Startup → Open default Window Arrangement. You can also save custom window arrangements and restore them later. For some reason, this option is disabled. Hence I have rely on macOS system settings.
Other iTerm setup
If you are new to iTerm you can checkout other setup guides that I have written, these setup would make you developing more interesting and fun.
