How do I have Safari 6 ask before quitting (to avoid accidental quits)?
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'