Recover Safari browsing history from May using Time Machine on Mac

In July this year I cleared my browsing history in Safari. I now need to revisit a webpage from May this year but have forgotten the address and obviously cannot use History. But if I know the folder where the browsing history details are located I am hoping I can use Time Machine to recover the web address that I now need. Is this doable?


Thanks

Nick


Apple Mac Mini, M2 Pro 2023

Sequoia 15.6


[Re-Titled by Moderator]

Original Title: Safari Browsing History Details

Posted on Aug 17, 2025 07:30 AM

Reply
4 replies

Aug 18, 2025 06:15 AM in response to photohk

Restoring the History.db SQLite3 databases from Time Machine will overwrite existing files, if that matters.


I wrote a short Zsh script that generates a CSV based on the history found in separate tables within History.db. If you select that written CSV on your Desktop after the script runs, you can use Apple's QuickLook (spacebar) to see a convenient tabular view of your history by date, title, and link. Where titles are not found, Unavailable will be substituted.


Source:

--------


#!/bin/zsh

: <<'COMMENT'
Generate a CSV document with headers showing current Safari History
database content. You can view the columnar CSV in a scrollable QuickLook window,
or load it into a spreadsheet

Reference: http://2016.padjo.org/tutorials/sqlite-your-browser-history/

Usage in Terminal:
./sql_dtu.zsh > ~/Desktop/hist.csv

VikingOSX, 2020-07-16, Apple Support Communities, No warranties expressed or implied.
COMMENT

sqlite3 -header -csv $HOME/Library/Safari/History.db \
"SELECT DISTINCT
    datetime(visit_time + 978307200, 'unixepoch', 'localtime') AS visit_time,
    coalesce(nullif(title,''), 'Unavailable') as title, url
FROM
    history_visits
INNER JOIN
    history_items ON
        history_items.id = history_visits.history_item;"
exit 0


Save this script on your Desktop as sql_dtu.zsh. Launch the Terminal application and enter the following:

cd ~/Desktop
chmod +x ./sql_dtu.zsh
./sql_dtu.zsh > ~/Desktop/hist.csv


Now, you can quit the Terminal, select hist.csv on your Desktop, and just press the space bar to view it.

Recover Safari browsing history from May using Time Machine on Mac

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