10

I'd like to know where does Safari store all the open tabs. My daughter did who-knows-what on my laptop and all tabs were closed (except hers of course...) and the "Reopen from last session" is greyed.

I know that when I update Safari, or even upgrade the OS, the open tabs are kept. I then suppose they are stored in a file somewhere on the HD. As I do have TimeMachine active, I hope that by restoring an older version of this file, I would be able to retrieve my open tabs. The problem being of course that I don't know where it stores them...

I'm on Safari 13.0.2 on macOS 10.13.6 (High Sierra - can't upgrade my early 2011 MBP, but I don't think it would have changed something)

2
  • I assume that for next time, you'll set her up her own managed account & not tell her the password to yours;-) idk what file you're looking for, but in the meantime, check whether there's any mileage in repeated Cmd/Shift/T which will keep reopening the previously closed tab [idk how far back that stretches, I've never had to test it beyond a few tabs] or alternatively look through the History list, Cmd/Y.
    – Tetsujin
    Nov 1, 2019 at 17:29
  • 1
    12 yo who just had to do some research for a school project when I was not home... Rookie mistake to trust your children when it comes to your safari tabs :-p
    – LudoMC
    Nov 1, 2019 at 18:47

2 Answers 2

14

OK, just found it! I closed Safari, restored the file ~/Library/Safari/LastSession.plist from my TimeMachine backup. I then restarted Safari and hit the "Restore from Last Session"

What a bliss to see my 71 tabs back to life!

2
  • Were they in private mode? Just confirming if private tabs go to backup. And if they were normal, 71 must have been tough using history ..
    – anki
    Nov 1, 2019 at 20:41
  • 1
    I don't use private mode, so I don't know if the private ones would end up there also. For the history, I opened some of them quite a long time ago and they don't appear in the history list anymore. And yes I know I have to close some of them... :)
    – LudoMC
    Nov 1, 2019 at 21:09
5

LastSession.plist is no longer used since Safari v15 for the purpose of storing the tabs.

To get back your tabs:

  1. Close Safari and make sure it's not running anymore
  2. In Finder Go to Folder... (from the Go menu)
    Paste in ~/Library/Containers/Safari/Data/Library/Safari
  3. Attach your TimeMachine disk
  4. Enter Time Machine from TimeMachine menu. It shows that Safari folder.
  5. Go back in history to the time from which you'd like to restore the tabs. Ue the TimeMachine's arrow keys to navigate in history.
  6. Select the following files holding CMD:
  • SafariTabs.db
  • SafariTabs.db-shm
  • SafariTabs.db-wal
  1. Click Restore below the window and confirm to replace for each file

Done: Start Safari and enjoy using your old tabs.

If the Safari window does not show your tabs, check the Window menu. Sometimes it re-opens in another window. You may switch back to the redundant window and close it before closing Safari, so you should be fine next time.

One more hint: In Finder's Go to Folder... enter the path containing ...Containers/Safari... rather than containing ...Containers/com.apple.Safari.... The latter is wrongly recalled as ...Containers/Safari.Safari... and will bring you to the wrong path when choose it from the history next time.

See https://www.reddit.com/r/Safari/comments/pvcz1v/comment/heb0yre/

1
  • 1
    Very wonderful answer and update. +1 indeed. Thanks for addressing newer os for this issue
    – bmike
    Sep 19, 2022 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .