How to Clear the macOS Application State Cache via Terminal

The Resume Feature

One of the hallmark features of macOS is its ability to seamlessly restore your exact workspace after a reboot or an application crash. If you have five tabs open in Safari and three specific documents open in Pages, quitting the app and reopening it will perfectly recreate that state. This magic is powered by the Saved Application State architecture.

As you work, macOS continuously writes your current window positions, scroll bar locations, and active document paths to hidden cache files. However, this convenience can become a nightmare. If an application crashes because it was attempting to load a corrupted image file, the Saved Application State will faithfully record that the app was trying to load that specific file. When you relaunch the app, it will read the cache, attempt to load the corrupted file again, and instantly crash in a never-ending loop.

To break this infinite crash cycle, you must forcefully purge the Application State cache using the Terminal.

Locating the Cache Directory

Because application states are unique to your specific workflow, they are stored within your user account’s protected Library folder.

The cache directory is located at: ~/Library/Saved Application State/

Identifying the Specific App Bundle

Inside this folder, caches are not named simply (e.g., “Safari” or “Mail”). They use Reverse Domain Name notation (the Application Bundle Identifier). For example:

  • Safari: com.apple.Safari.savedState
  • Mail: com.apple.mail.savedState
  • Google Chrome: com.google.Chrome.savedState

Purging the Cache via Terminal

You do not need elevated (sudo) privileges, but you must ensure the crashing application is completely force-quit before attempting to delete its state.

  1. Force Quit the problematic application (Option + Command + Escape).
  2. Open the Terminal application.
  3. To delete the state for a specific application (e.g., Safari), execute:
rm -rf ~/Library/Saved\ Application\ State/com.apple.Safari.savedState

(Note: The backslashes in the path are required to escape the spaces in the folder name).

The Nuclear Option: Clearing Everything

If multiple applications are exhibiting bizarre behavior, or if your Mac is struggling to log in smoothly after a reboot, you can purge the entire directory. This will not delete any actual documents or application data; it will simply force every app to open to its default “blank” state the next time it launches.

rm -rf ~/Library/Saved\ Application\ State/*

Preventing Future States

If you have an application that consistently crashes and you want to permanently revoke its ability to save its state, you can lock the directory. After deleting the cache, recreate the folder as an empty directory and lock it using the chflags command:

mkdir ~/Library/Saved\ Application\ State/com.apple.Safari.savedState
chflags uimmutable ~/Library/Saved\ Application\ State/com.apple.Safari.savedState

macOS will now be mathematically prohibited from writing a saved state for that specific application ever again.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.