How to Stop macOS from Automatically Closing Inactive Windows

The Disappearing Documents

macOS features a highly aggressive, deeply hidden memory management system known as “Automatic Termination.” Designed primarily for older Macs or entry-level MacBooks with limited RAM, this feature allows the operating system to quietly close applications in the background if they have not been used recently and the system requires more memory for active tasks. While this keeps the active window running smoothly, it can be infuriating if you switch away from a complex Numbers spreadsheet or a long Pages document for an hour, only to find that macOS has completely closed the window and you must manually hunt down and reopen the file.

Disabling Automatic Termination

To ensure your workspace remains exactly as you left it and stop macOS from automatically closing inactive application windows to save memory, you must override this behavior using a terminal command.

Apple does not provide a simple toggle switch for Automatic Termination in the standard System Settings. You must use the Terminal to modify the global defaults database. Open your application drawer, navigate to the Utilities folder, and launch Terminal. Type the following command exactly as written: defaults write -g NSDisableAutomaticTermination -bool yes and press Enter. The command will execute silently without a confirmation message. You must restart your Mac for this global change to take effect across all applications. Once rebooted, macOS will respect your open windows; an application will only close when you explicitly press Command+Q or click the red “X” button.

Get the best tech tips delivered straight to your inbox.

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