Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In Mac OS X Lion 10.7, Safari preserved the state of my tabs when it closed. This functionality seems to have disappeared in OS X 10.8 Mountain Lion. Is there a way to restore (no pun intended) this feature from with the System Preferences or perhaps a Terminal trick?

share|improve this question
1  
If you have not enabled Close windows when quitting an application under System Preferences > General, Safari reopens all tabs and windows. –  gentmatt Jul 26 '12 at 17:38
    
I haven't touched any settings. Edit: It was enabled by default. –  Moshe Jul 26 '12 at 17:46
    
§$%&""§! Do you want me to answer still or will you just remove the question? –  gentmatt Jul 26 '12 at 17:49
1  
Answer it please. For future Googlers. –  Moshe Jul 26 '12 at 17:50

3 Answers 3

up vote 5 down vote accepted

Undo quitting of all applications

Apple has slightly changed the wording but the location for this setting is still the same as in Lion:

System Preferences → General → Close windows when quitting an application

Undo quitting for a specific application

This works only with Close windows when quitting an application disabled at the same time.

Type the following command in the Terminal. Then restart the specific application.

In general the syntax is:

defaults write com."producer"."program-name" ApplePersistenceIgnoreState YES

Thus, in your case (Safari.app) it is:

defaults write com.apple.Safari ApplePersistenceIgnoreState YES

You can undo this by using the parameter NO instead.

If you prefer a graphical interface, you can use TinkerTool. But the current version 4.9 only supports the toggling on a per app basis in Lion. I'll update this answer when TinkerTool adds this feature for Mountain Lion as well.

share|improve this answer
    
So I can use the Terminal to enable this while leaving the setting in System Preferences as it was? –  Moshe Jul 26 '12 at 18:56
    
Not really, it only works the other way around. Will edit. –  gentmatt Jul 26 '12 at 18:57
    
This doesn't seem to work for me. The function is disabled in the preferences, but safari still doesn't remember my tabs. When i quit and re-launch, a new window opens, not even in full-screen mode (Which i usually use). I even tried using the terminal command like you said, in the correct way. Help? –  user26790 Aug 5 '12 at 11:43
    
@Sherwin I can't really help with that. It's working for me... all I can say is to carefully read the answer again. I tested this in Safari on Mountain Lion. –  gentmatt Aug 5 '12 at 14:44

If you already have the "Close windows when quitting an application" setting disabled, but certain apps don't restore their windows (while most other apps do), this fix worked for me:

  1. Open System Preferences -> General, and check the "Close windows…" setting.
  2. Close System Preferences
  3. Reopen System Preferences -> General, uncheck the same setting, and close it again.

The setting should now be applied uniformly across all apps. At the very least, this fixed the issue where Safari would not restore its windows (even though other apps were doing so). (In my case, back in Lion I disabled window restoring on a few specific apps with the hidden setting via Terminal; Safari may have been one of them.)

share|improve this answer
    
Thanks, that did the trick for me! –  canisbos Aug 14 '12 at 18:25

You also need to check the NSQuitAlwaysKeepsWindows setting:

defaults read .GlobalPreferences NSQuitAlwaysKeepsWindows
defaults read com.apple.Safari NSQuitAlwaysKeepsWindows

The default behaviour should be a "does not exist" error, but if either is set to 0 Safari will not remember open tabs.

You can restore the default setting with:

defaults delete .GlobalPreferences NSQuitAlwaysKeepsWindows
defaults delete com.apple.Safari NSQuitAlwaysKeepsWindows
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.