How to Recover Deleted Safari History on Mac

Jun 21, 2018 - 10 Comments

How to restore and recover deleted Safari history on Mac

Have you ever wanted to recover deleted Safari history on a Mac? Maybe you unintentionally cleared all history and web data or deleted specific Safari history and you’d like to reverse those decisions and get the browsing history back? Or maybe you’re doing a little bit of investigative work for some reason or another, or you’d like to explore some simple digital forensics for Safari browser history on a Mac?

We’ll show you a simple way of recovering deleted Safari history on a Mac.

Since we’re aiming for a simple approach here, we’ll be relying on Time Machine, the backup service on Macs, which happens to offer the simplest way to recover deleted Safari history on a Mac – or recover any deleted file for that matter – though our focus here is on the Safari web browser. Thus, this approach obviously requires an accompanying Time Machine backup used by the particular Mac in question. If the Mac does not have a Time Machine backup setup and regular backups that are maintained, this simple history recovery approach will not work. Because this restores via a backup, any interim data between when that backup was made and when the restore happened will be lost, so keep that in mind before beginning this process, particular if the current browser history is also important – it’d be wise to back it up first too.

How to Recover Deleted Safari History on a Mac, the Easy Way

Assuming you have the Time Machine backup, here is how you can recover deleted Safari history on a Mac:

  1. Quit out of Safari in Mac OS if you have not done so already
  2. Connect the Time Machine backup drive to the Mac if it is not already connected
  3. From the Finder, pull down the “Go” menu and choose “Go To Folder” and enter the following path:
  4. ~/Library/Safari/
    Go to Folder to the Safari data location on Mac

  5. Once you’re in the ~/Library/Safari directory, select the “History.db” file and then pull down the Time Machine menu in the upper-right corner and choose “Enter Time Machine”
  6. Enter Time Machine from the

  7. Navigate and scroll through Time Machine history of the ~/Library/Safari/ directory, when you reach the desired date that contains the Safari history data you’d like to recover, click on the “Restore” button in Time Machine
  8. Restore and recover deleted Safari History

  9. When Time Machine finishes restoring the ~/Library/Safari/ directory, you’re now free to access the freshly recovered version of the deleted Safari history
  10. Relaunch Safari on the Mac with the freshly restored History now intact
  11. In Safari, pull down the “History” menu and choose “Show All History”
  12. How to show all browsing history in Safari on Mac

  13. You can now browse, search, and find specific Safari history from the restored Safari History.db file just like you would as usual
  14. Browsing through Safari web history on Mac

That’s it, now you have restored the browser history from Safari that was deleted!

Inside the ~/Library/Safari/ folder on the Mac, you’re specifically looking for the “History.db” file, which can be a good size depending on how much web browsing you do. It’s essentially just a database file that you can query directly with SQL if you’d like to, but that’s not what we’re going to do here since you can also just access, search, and browse through Safari history in Safari on the Mac itself, and we’re aiming to keep things simple for this particular tutorial.

Note this approach will only work for recovering and restoring Safari browsing history that was deleted or cleared from the Mac, it will *not* work for recovering a private session where no history was created. For example, if you use Private Browsing in Safari for Mac to prevent history from being gathered in the first place, there would be no history data to restore from Time Machine (or in general outside of some complicated memory or swap extraction attempt anyway, which is exceedingly more advanced than this tutorial would even attempt to imply, though it could be theoretically possible in some scenarios).

Obviously this approach is for the Mac, but theoretically you could use a similar method for iOS too. Users can always search Safari History on the iPhone or iPad too, as well as delete specific browser history on the iOS Safari browser, but to recover deleted Safari history in iOS you would need to be able to restore a device with a backup either from iCloud or iTunes that contained the deleted Safari history. That’s a topic for another article however, so that won’t be discussed here.

Was this helpful to you if you needed or wanted to restore deleted Safari web browser history on a Mac? Do you know of another approach that works? Share your comments and experiences in the comments below!

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Security, Tips & Tricks

10 Comments

» Comments RSS Feed

  1. Sharon says:

    I have tried these steps. I still am not able to recover my browsing history. Any advise?

  2. Paul Robert Stephenson says:

    Just tried this on Mac OS Catalina. As soon as I launched Safari afterwards it replaced the recovered History.db (9MB) with the original one (98KB). Any thoughts?

    • Grenouille says:

      I had the same problem on macOS Big Sur. It turns out that background processes of Safari are still running even after quitting the Safari app itself. They are the ones causing the restored History.db to be completely ignored and overwritten. Here is the solution I found: 1) Open Utilities > Activity Monitor 2) Quit not just Safari, but any processes containing “Safari” in their name, such as “com.apple.Safari…” 3) Restore History.db 4) Launch Safari again

  3. Bill says:

    I’ve tried to recover my Safari history going back about a year. All I can get via Time Machine is about 3 weeks (18.4 MB of data). This was using your procedure above. Should I be recovering (at the same time) the other history files (history.db-lock, history.db-shm, history.db-wal)? Can I restore all 4 files at the same time via Time Machine?

  4. Apps says:

    What I’m afraid of is replacing the current history with the restored one without merging them together…

  5. Liam says:

    Geez, I go out of my way to completely and utterly erase all web-browser data after each and every session… Does anyone really trust the internet now-a-days ?

  6. pws442 says:

    Wouldn’t this eliminate new history since the date of the backup?

    • darthy says:

      Yes, unless you copy that too. This is mentioned in the third paragraph of the article, regarding new browser history since date of backup:

      “Because this restores via a backup, any interim data between when that backup was made and when the restore happened will be lost, so keep that in mind before beginning this process, particular if the current browser history is also important – it’d be wise to back it up first too.”

      FWIW that is also how system restores work when downgrading or restoring other aspects; the restore is from the time of that backup, so interim data is lost unless it’s copied separately.

      Frankly I am a little surprised that Time Machine doesn’t offer a “diff” service to address that, but that could be seen as overly complex for how Time Machine aims to be simple. Or “merge” too, like what is frequently seen in version control systems.

      Also a little surprised that Time Machine doesn’t offer cloud backups yet…

  7. Arpana says:

    Unfortunately, I have not been using Time Machine. So I wonder if I can recover deleted safari history.

  8. The Dude says:

    Great article, this has a lot of potential uses! I have accidentally trashed Safari history before myself and used nearly the same methodology to recover it, though I had to figure it out on my own rather than use a nice guide like this.

    One thing to note, there is a difference with new Safari vs old Safari, though I do not know the version cutoff.

    The new modern versions of Safari have Safari history located at:

    ~/Library/Safari/History.db

    The History.db file is a database file, you can use SQLite to access it directly with all URLs, date, time, etc.

    Meanwhile, the older versions of Safari have history located at:

    ~/Library/Safari/History.plist

    In those older versions of Safari, History.plist is a simple plist file that can be read or accessed through a quality text editor (BBedit etc) or plist editor.

    Same overall directory, just a different file (plist vs db).

    However, the restore approach from Time Machine would be identical, except in this case for older Safari versions on Mac you are looking for

    ~/Library/Safari/History.plist

    rather than

    ~/Library/Safari/History.db

    All else is the same though.

    I have went through this before when accidentally deleting the History.plist file and I recovered it manually through Time Machine in the way described, it works exactly the same.

    Just in case this is helpful to anyone ;)

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site