12

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)

0

3 Answers 3

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
    Commented 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
    Commented Nov 1, 2019 at 21:09
7

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
  • Thank you, works like a charm! Commented Jun 17 at 18:50
1

Thanks, but It didn't work for me, now in macOS Sonoma 14.4.1 / Safari 17.4.1.

I lost about 300 open tabs in various windows and restored the 3 Tabs.db files the next day. But after restoring, Safari opened just one single window with 5 tabs from when I quit it a few minutes before the restore. Interestingly, when closing this window, I got a dialogue warning me that I have 300 open tabs, though the window contained just these recent five ones.

Trying several times, having lost quite some time and being a little annoyed, I took the risk and simply restored the whole Safari folder ~/Library/Containers/Safari/Data/Library/Safari and the folder Saved Application State below.

Voila, the 300 tabs were back. But just a few seconds later, they disappeared again and were replaced by the 5 more recent ones. Safari probably did some web tab sync or something.

So I disconnected the comp from the Internet, ran the restore anew, added the 300 resurrected tabs to the reading list not to loose them again. Only after this I went back online, whereupon with a few seconds delay Safari promptly fetched again the most recent 5 tabs from somewhere in the cloud and the 300 older ones were replaced again.

Please note: Due to the short period of time between the restored backup and the restore, in my case not even a day, there was no big risk that I would lose much other information such as bookmarks, history or similar created since the time of the backup I wanted to restore.

If the period was longer, say several days, to be on the safe side, I would probably do this on a temporary partition, computer or user, export the restored tabs as bookmarks and transfer them to the relevant Safari.

You must log in to answer this question.

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