When most Mac users delete their Safari browser history, the last thing they want is for it to ever come back. But from time to time, users clear their browsing history on accident or realize that it contained an important website whose address they don’t remember anymore.
If you’re currently in the same situation, then this article will help you solve it because it describes the top 3 ways to recover deleted Safari history on Mac. But before we get to them, we need to briefly explain what Safari browser history actually is and where you can find it.
Table of Contents
What Is Safari History and How to Find It?
Safari history is a database containing previously visited websites. Just like most other web browsers, Safari keeps it automatically to make it easier for users to revisit familiar websites without having to enter their addresses over and over again.
To view Safari history:
- Open Safari on your Mac.
- Choose the History option.
- Click Show All History
You should see a table with two columns and multiple rows. The first column from the left shows the names of previously visited websites, while the second column shows their addresses. Individual entries are grouped by date, so you can easily go back in time and view history on Safari Mac from a specific date. Alternatively, you can use the search bar in the top-right corner to find all history entries that contain specified keywords.
All the information that you can see when you click the Show All History button is stored on your hard drive, inside a file called History.db. This file is located in the ~/Library/Safari/ folder.
To find and open the History.db file:
- Open Finder.
- Choose the Go option.
- Click Go to Folder.
- Enter the path to the Safari history file location in the textbox and click OK.
- Open History.db with TextEdit.
You will see a long text file that’s anything but easy to decipher. That’s because History.db is actually an SQLite database file, and it’s not intended to be viewed in a regular text editor. Instead, you should open it using a database browser like DB Browser for SQLite, which you can download for free right from its official website.
After installing DB Browser for SQLite, launch the app and click Open Database. Select the History.db file and switch to the Browse Data tab. Finally, select the history_items table.
You should see a rather nicely formatted list of URLs and corresponding domain names, and you can sort it alphabetically.
How Can Safari History Be Deleted and When It Can Be Recovered?
Let’s take a look at some common reasons for deleting Safari history and whether it can be recovered:
- 🎯 Intentional deletion: Many Safari users like to keep their browsing history squeaky clean to prevent others from examining their online activity. That’s all fine and good until you need the address of a website you’ve visited a long time ago and can’t remember it.
- 🩹 Accidental deletion: All you need to do to delete your Safari history is click the Clear History button and confirm your decision. By default, Safari deletes only the last hour of browsing history, but you can also tell it delete all history in one go. What often happens is that users want to delete only the last hour but don’t notice that the option to delete all history is selected, causing their entire browsing history to disappear immediately.
- 🔐 Private Browsing: Safari allows you to open a Private Window (Command+Shift+N) that prevents your browsing history from being recorded. Safari users sometimes don’t realize that they’re browsing the web in the Private Window and wonder why their browsing history hasn’t been recorded.
- 🗃️ Formatting: When reinstalling macOS, it’s sometimes a good idea to first format the system drive to start with a clean slate. It goes without saying that formatting doesn’t erase just Safari history but also all other files stored on the hard drive.
- 👾 Hackers: Mac users are relatively safe from malware since most cybercriminals target Windows computers, but that doesn’t mean they are completely immune. From ransomware to remote desktop hacks, there are multiple cyber-threats that can cause Mac users to lose their entire Safari browsing history in the blink of an eye.
How to Perform Safari History Recovery?
There are three main methods for recovering Safari history on Mac, and we describe all of them in the same order we recommend you try them.
Method 1: Use Disk Drill
Disk Drill is perfect for recovering a History.db that has been accidentally deleted or lost during formatting. As long as the file hasn’t been overwritten, you should be able to completely recover it.
To restore deleted history of Safari browsing with Disk Drill:
- Download and install Disk Drill for Mac.
- Launch Disk Drill and select your main hard drive.
- Click Search for lost data.
- Type “history.db” into the search field in the top-right corner and hit Return.
- Select the deleted History.db file and click the Recover button.
- Choose a safe recovery destination and click OK.
You can then view deleted Safari history in your favorite text editor or database browser. To view it in Safari, you need to copy the recovered History.db file to ~/Library/Safari and overwrite the file that’s currently in the location.
Method 2:Restore from iCloud backup
If you’re using iCloud to back up your Safari data and keep it synchronized across devices, then you can recover deleted Safari history using your iPhone or any other iOS and iPadOS device that still contains the original browsing history data.
Here’s what you need to do:
- Open the Settings app on your iPhone or iPad.
- Tap on your name.
- Select iCloud.
- Locate Safari and toggle the switch next to it until you’re prompted to merge your data.
- Click Merge.
This way, you force your iPhone to overwrite Safari browsing history in iCloud, which, in turn, allows you to recover deleted Safari history on Mac just by turning on the Safari option in iCloud settings (see the last section of this article for a step-by-step guide).
Method 3: Restore from Time Machine backup
Safari history recovery can also be performed using Time Machine. While you could choose the nuclear option and restore your entire Mac to an earlier state from Recovery, it’s much less time consuming to only recover the History.db file, which, as we’ve explained earlier in this article, contains all previously visited websites and is stored in the ~/Library/Safari directory.
To restore deleted history of Safari browsing using Time Machine:
- Close Safari
- Open Finder and select Go -> Go to Folder.
- Enter ~/Library/Safari and click the Go button.
- Scroll down until you find the History.db file and select it.
- Click the Time Machine icon located in the Menu Bar and choose Enter Time Machine.
- Go back in time until you see a version of the History.db file that contains your lost Safari browsing history.
- Click Restore to restore the selected file.
The next time you open Safari, your browsing history should be back. That’s how easy it is to retrieve deleted history of Safari browsing using Time Machine.
The only problem with this method is that it will work only if Time Machine was enabled prior to the data loss incident. If it wasn’t, then you won’t have any backup of the History.db file to recover.
How to Prevent Safari History Loss?
The best way to prevent Safari history loss is to turn on Safari in iCloud preferences. That way, iCloud will automatically back up your Safari data to the cloud, allowing you to keep it synchronized across your devices and easily retrieve it should anything happen to your Mac.
To back up your Safari browsing history with iCloud:
- Open the System Preferences app on your Mac.
- Select iCloud.
- Check Safari.
Your Safari browsing history will be automatically synchronized across all Apple devices that use the same Apple ID.
FAQ
Use this simple procedure to recover closed or deleted Safari tabs on an iPhone.
- Open Safari and tap the Tabs button in the bottom-right corner. (It’s two overlapping squares)
- Tap and hold the Plus (+) button at the bottom of the screen.
- A list of the recently closed tabs is displayed. Tap an item to open it in a new tab.
- Save the tab as a bookmark to ensure it never gets lost.
You can use the following procedure if you have backed up your iPad to iCloud.
- Select Settings > General > Reset on your iPad.
- Choose Erase All Content and Settings.
- Follow the setup prompts and select the Restore from iCloud Backup option in the Apps & Data screen.
- Sign in to iCloud and select a backup that has your deleted Safari history and use it to restore your device.
You can use data recovery software like Disk Drill to recover your deleted Google Chrome history with the following procedure.
- Install Disk Drill on your Mac.
- Connect the iPhone to your computer.
- Launch Disk Drill and select the iPhone from the disk list.
- Click the Search for lost data button to scan the device.
- Preview the found files and look for a Google Chrome History and Preferences file.
- Select the file to be restored and click the Recover button.