Runar Ovesen Hjerpbakk

Science-based software development

Disable OS X Lion Resume per application

I sometimes divide applications into two groups: one group contains applications which creates content while the other contains viewers. Examples in the first group could be Word or your favorite IDE. The second group contains applications for viewing PDFs, images or videos such as Preview or QuickTime.

OS X Lions Resume feature enables applications to be opened in the same state as when they were closed. This saves time for programs where you wish to continue working on the same stuff, but can be annoying for most viewer applications. Using Preview to view an image from the Finder will open the image together with the images opened the last time the Preview was run. Not always what you want.

Luckily there are (at least) three ways to tweak the Resume behavior:

  1. In System Preferences this setting can be disabled system wide by disabling General > Restore windows when quitting and re-opening apps.
  2. Pressing Option  when quitting an application from the menu or using Cmd+Q will disable Resume for the last session. Cmd+Q = quit and resume later, Opt+Cmd+Q = quit and forget the open windows.
  3. From the Terminal the Resume functionality can be disabled on a per application basis by using the command: defaults write [application identifier] NSQuitAlwaysKeepsWindows -bool false. For example defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false will disable Resume for QuickTime after a restart. Issuing the command again using true instead of false, will re-enable Resume for the application.

Finding the application identifier

In order to find the application identifier to use in the command above, Activity Monitor can be used.

Open Activity Monitor and search for the relevant application (TextEdit in this example). Press Sample Process and the following window will appear. The identifier can be copied from this window.

Input the command in Terminal using the identifier from step two.