It’s really very simple – everything you need is in ~/Libaray/Safari/LastSession.plist just quit Safari and restore that file from when it was good and you’re done.
What’s this about?
Well I tend to use open Safari windows/tabs to help keep me focused on foreground tasks while minimising backround/interesting/to-do articles etc. Occasionally I forget to restore all my windows after restarting Safari for a quick session (usually whilst preparing for shutdown/restart/software update).
Next time you try to restore all your windows and don’t get what you expected – remind yourself this is why that extra Time Machine disk was such a useful investment.
Hope this helps.
4th February 2016 at 11:57 pm
This method used to work but doesn’t anymore. Although the safari folder still has a lastsession.plist file, restoring it from time machine, or restoring anything else in that folder, will no longer bring back your windows and tabs. For that, you’d have to restore the com.apple.Safari.savedState folder, and time machine doesn’t back that up, so, now, in order to restore lost safari tabs, you have to first figure out a way to get time machine to back up that folder (which I don’t know how to do), unless you want to periodically back up the folder manually.