No Content Restored

When Session Restoration is enabled, your sessions will not terminate if iTerm2 exits unexpectedly (as in a crash or force quit).

When iTerm2 starts up, it finds all extant sessions and attaches to them. This combines with the OS's window restoration feature, which saves the contents and appearance of your windows periodically so that they may be restored when an app restarts.

Because the OS is responsible for saving the content of the window (the scrollback history, screen contents, and so on), it's possible that iTerm2 will attach to a running session but not be able to restore its contents because the mechanisms are independent from one another.

Configuration

Some configurations make this likely to happen:

  • Settings>General>Startup should be set to Use System Window Restoration Setting. The other options (Use Default Window Arrangement and Don't Open Any Windows) discard the contents of some or all windows, leading to the lost content problem.
  • macOS's System Settings>Desktop & Dock>Close windows when quitting an application should be off. When on, window contents won't be saved by the OS,

Other Causes

If you run two copies of iTerm2 at the same time and both exit, only one instance's windows' contents will be saved, causing this problem when you restart.

Because window contents are only saved periodically, a short-lived session may not have its contents saved.