Is there a way to save/restore the browser history on Safari? I'm asking because I found a way to show the hidden Debug menu on the browser where there is an option Sync iCloud history. The thing is that I don't want rely only on iCloud to restore the browser history. Besides, I really don't know whether syncing iCloud's history would work like that, or rather would merge or override the history or some other particular kind of data in all devices.
2 Answers
Safari history is stored in an SQLite database located at
~/Library/Safari/History.db
You can copy this file elsewhere to save it, then restore it by copying it over the top of the existing file (while Safari is quit).
-
1I has thinking to write a script to archive all the data Safari has, just in case. Is there some other information besides the .db files I should be archiving?– rraallvvJun 10, 2018 at 17:06
I use a Safari extension name Sessions. The code is available on GitHub here. This will only work on Safari version less than 12. Apple has deprecated Safari Extensions in v12.
Sessions keeps track of your open windows and tabs for you. With the click of a button you can save a snapshot of your session at any time and start fresh, secure in the knowledge that you can return to your tabs at your future leisure.
Sessions is efficient, lightweight, and gets out of your way; with automatic backups enabled, you do not have to think about it until you need it. Every aspect of its design has been carefully considered and infused with familiar Mac sensibilities. And with Sessions's rich tab management and searching abilities, losing a link may be a thing of the past.
I can go back several days thru my browser tab history and even delete old sessions I no longer need. It does all of this in the background so I don't have to do anything.
-
2It's still possible to use these extensions with Safari 12, I wrote a tutorial on this: Install any extension blocked by Safari in macOS Mojave using Safari's developer tools.– grg ♦Jun 9, 2018 at 17:13
-
Where does Sessions store the data, on iCould? Can I restore the latest snapshot, just by logging in to iCloud with the extension installed from a clean system installation? Thanks.– rraallvvJun 10, 2018 at 17:10
-
I don't know the answer. You would have to look at the site and see if provides that info. I've never ran into a situation like that where I needed my last tab session across system installs.– fsbJun 10, 2018 at 18:00