I will provide a detailed explanation of the /Library/Saved Application State/ folder in macOS, covering the following aspects:

I will gather and compile this information and get back to you shortly.

/Library/Saved Application State in macOS: Comprehensive Analysis

Data Storage

The Saved Application State folder is where macOS stores per-app UI state data for the system’s “Resume” feature introduced in OS X Lion ( Delete Specific Application Saved States from Mac OS X Resume ). This folder (located in a user’s home Library by default, i.e. ~/Library/Saved Application State/) contains subdirectories for each application (named <bundle-id>.savedState). Each such subdirectory holds the app’s last-used state so that when you relaunch the app or reboot your Mac, it can resume with all the windows and data that were last in use ( Delete Specific Application Saved States from Mac OS X Resume ). For sandboxed apps, the saved state is kept in the app’s container (e.g. ~/Library/Containers/<bundle-id>/Data/Library/Saved Application State) (Archaeology | Saved Application State), but the content and purpose remain the same.

Within each .savedState folder, macOS maintains a set of files that capture the UI state:

In summary, the Saved Application State folder stores each application’s UI state (windows and session information) so macOS can recreate your working environment. It’s essentially a cache of UI state: window layouts in windows.plist and the contents/state of those windows in data.data, often accompanied by visual snapshots. macOS writes to these files whenever an app’s state is saved (e.g. on quit or system restart), and reads them back when the app is launched to restore its previous state.

State Management

macOS manages saved application state automatically via the AppKit framework and a background daemon called talagent (Transparent App Lifecycle Agent) (Archaeology | Saved Application State). Whenever you quit an app (provided the system setting **“Close windows when quitting an app” is disabled, meaning Resume is enabled) or when you restart your Mac with “Reopen windows when logging back in” checked, the system will capture the app’s UI state and write it to the Saved Application State folder (Archaeology | Saved Application State). AppKit/TALAgent create or update the .savedState files at those moments without user intervention. (Internally, Cocoa applications cooperate by encoding their state via methods like NSResponder#encodeRestorableStateWithCoder: – the results end up in the data.data file mentioned above (Archaeology | Saved Application State).)

When an application is launched, AppKit will check for a corresponding saved state and automatically restore the windows and UI to the last recorded state (unless Resume is turned off globally or suppressed for that launch). Each preserved window is reconstructed: the app reads windows.plist to learn what windows existed and uses the IDs and keys to decrypt the saved data in data.data, thereby restoring objects, open documents, scroll positions, cursor locations, etc. Standard Cocoa windows/views restore themselves, while apps can also restore custom state as needed (The Core App Design) (The Core App Design). If the savedState files are missing or removed, the app will simply launch as if no previous session existed (no error – the files are treated like cache and will be regenerated on next quit ( Delete Specific Application Saved States from Mac OS X Resume )).

State restoration is typically performed at: login (for apps that were running at logout), app launch (if a saved state exists), or app relaunch after a crash. Users have some control over this process: