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?
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:
Thus, in your case (Safari.app) it is:
You can undo this by using the parameter
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.
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:
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.)