Skip to main content

Getting a list of URLs from my Safari history

  • Posted

The Safari history is stored in an SQLite database which you can query.

Here’s the query from a throwaway web app I built to show me the websites I visit most often in Safari:

SELECT v.title, v.visit_time, i.url
FROM history_visits v
LEFT JOIN history_items i on i.id = v.history_item

It queries the Safari database at ~/Library/Safari/History.db.

I deleted the rest of the app because it was just a Flask wrapper that showed a Chart.js chart of the data, and I didn’t actually find it useful – but this bit might be interesting.