Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.


macrumors member
Original poster
Jul 1, 2009
I've found a lot of unfamiliar Youtube links in my Safari browsing history. Is it possible that it was hacked somehow?

Is there any way to see a timestamp for when links were accessed or locations from which they were accessed, assuming its even possible to hack it to begin with?


macrumors 6502
Mar 2, 2023
Maybe they are the result of some pop up ads.

Copy ~/Library/Safari/History.db to your Downloads folder and you can open it using sqlite3. The history items do have some relations to timestamps but I can't decipher them. They are not stored in a human-readable format.


macrumors 68030
Mar 17, 2010
This was my StackExchange answer

Safari's history (all the history) is in the database ~/Library/Safari/history.db.

For safety, duplicate this database, so you have ~/Library/Safari/history copy.db.

To explore the database I use SQLPro for SQLite which you can get from the Mac App Store. Use this or any similar app.

Open the database with SQLPro for SQLite.

The first thing you should see (in the left hand pane) is a list of the tables in the database.

enter image description here

Now select Query from the tool bar and enter this query:

select datetime(v.visit_time + 978307200, 'unixepoch', 'localtime') as date, i.domain_expansion, i.url
from history_items i left join history_visits v on = v.history_item
order by desc
limit 100;

This will combine data from two tables to give you a list of the most recent 100 of your history. The only tricky bit is the conversion of the date to make it readable.

After entering the query and clicking on the green arrow (Execute Query) you should get results in the lower pane similar to those in the screenshot.

When you are happy with the result, increase the limit to show more (or all) of your history - it may well be 100,000 of more.

Use the 'rectangle with arrow' at top left of results choosing 'Export export results set as' and 'CSV...'. Save the file which can then be used in Excel, Numbers (rather slow) or a text editor.

Disclaimer: The query was modified from one I found on the web.
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.