How do I have Safari 6 ask before quitting (to avoid accidental quits)? Safari used to have a preference option to confirm before quitting, now that has disappeared.  It's so easy to quit accidentally and lose all your tabs.  I know you can resume or re-open the previous session, but those are not solutions to the problem.

How do I make Safari ask me before quitting?
The setting was called "Confirm before closing multiple tabs or windows", but it was removed in 10.7 when Resume was introduced. defaults write com.apple.Safari ConfirmClosingMultiplePages -bool true doesn't work anymore either.

The part of Resume where application state is kept after quitting was disabled by default in 10.8, but you can reenable it from the General preference pane:



You can also enable it in just Safari by running defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool true and quitting and reopening Safari.

Safari will still reload tabs when they are restored. And restoring state has only worked about half of the time for me since Safari 6 or 10.8.

You might also change the shortcut for quitting Safari:



Or disable some of the shortcuts completely:

defaults write com.apple.Safari NSUserKeyEquivalents -dict 'Quit Safari' '\0' 'Close Window' '\0' 'Close All Windows' '\0'