Restoring all Safari settings/tabs from backup

I'm upgrading to a new Mac and starting afresh. I want to start with every app in its default state...except Safari.


What do I need to restore from my backup of the old Mac in order to restore Safari on the new machine to EXACTLY the same state it is in on the old one? I've never managed to get this quite working. Previously I've copied:


~/Library/Safari

~/Library/Saved Application State/com.apple.Safari.SavedState

~/Library/Preferences/com.apple.Safari*


...but there's always something missing. Normally having done so, when I launch Safari I get a single blank window and have to select "restore previous windows from last session", which sometimes leaves windows and tabs missing.


Are there any other files or directories I need to copy? Or is it a case of deleting every Safari-related file on the new machine, restarting, then copying? Even that hasn't worked in the past.

MacBook Pro Apple Silicon

Posted on Jul 27, 2022 11:16 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 27, 2022 02:28 AM

I finally (almost) managed to make this work. The key seems to be in


~/Library/Containers/Safari


...or:


~/Library/Containers/com.apple.safari


...which seems to be an alias.


Everything in that folder needed to be duplicated: not just the saved application state. So the following directories needed to be duplicated:


~/Library/Safari

~/Library/Preferences/com.apple.Safari*

~/Library/Containers/Safari


One has to be careful with the last one: I didn't try just copying the folder over since it contains so many aliases that I didn't want them to break by pointing at the wrong source directory. So it was a laborious process having to drill down into each directory and copy the contents. But that seems to have done the trick.


Well, almost. The first time I restarted my Mac (I think) and reopened Safari, I got the same behaviour with 4 blank windows with no tabs, rather than 4 windows with ~30 tabs each full of content. But the windows could be recovered within Safari through:


History -> Recently Closed


...finding the name of the first tab in the missing window — which is reasonably easy to identify as it has "(and N more tabs)" next to the name — and selecting "Reopen Window". All of these were at the top of the History, meaning that Safari had at least recognised that all the windows I wanted were the last thing it closed...


So there's still a bug in there somewhere and I still haven't worked out exactly how to restore everything without any issues, but I can at least restore everything.

3 replies
Question marked as Top-ranking reply

Aug 27, 2022 02:28 AM in response to ComteDeJollois

I finally (almost) managed to make this work. The key seems to be in


~/Library/Containers/Safari


...or:


~/Library/Containers/com.apple.safari


...which seems to be an alias.


Everything in that folder needed to be duplicated: not just the saved application state. So the following directories needed to be duplicated:


~/Library/Safari

~/Library/Preferences/com.apple.Safari*

~/Library/Containers/Safari


One has to be careful with the last one: I didn't try just copying the folder over since it contains so many aliases that I didn't want them to break by pointing at the wrong source directory. So it was a laborious process having to drill down into each directory and copy the contents. But that seems to have done the trick.


Well, almost. The first time I restarted my Mac (I think) and reopened Safari, I got the same behaviour with 4 blank windows with no tabs, rather than 4 windows with ~30 tabs each full of content. But the windows could be recovered within Safari through:


History -> Recently Closed


...finding the name of the first tab in the missing window — which is reasonably easy to identify as it has "(and N more tabs)" next to the name — and selecting "Reopen Window". All of these were at the top of the History, meaning that Safari had at least recognised that all the windows I wanted were the last thing it closed...


So there's still a bug in there somewhere and I still haven't worked out exactly how to restore everything without any issues, but I can at least restore everything.

Jul 28, 2022 01:35 PM in response to ComteDeJollois

Hello ComteDeJollois,


Thank you for reaching out to Apple Support Communities, and we'll be happy to help in any way we can. We understand you're having issues with restoring Safari after erasing your Mac. Check ou tthe steps listed here to see if they resolve the issue: Restore items backed up with Time Machine on Mac - Apple Support


"With many apps, you can use Time Machine within individual documents, so you can examine and read past versions to find the version you want. See View and restore past versions of documents.

You can use iCloud Drive and iCloud Photos to safely store your documents, photos, and videos in iCloud. See Ways to back up or protect your files."


We hope this helps.


Cheers!




Jul 29, 2022 01:49 AM in response to K_Faith

Hi K_Faith,


In answer to your question, no it doesn’t help in the slightest. Although I didn’t say it, I know how to restore items from Time Machine (although my backup is a simple SuperDuper! disk clone because its more efficient for this specific purpose).


What I don’t know is specifically what to restore. Which files and directories should I select to get Safari — and only Safari — restored to the state it exists on the backup? Either the location on Macintosh HD or instructions on restoring with Time Machine would be fine: I can take it from there.


CdJ.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Restoring all Safari settings/tabs from backup

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.