Your Mac Remembers Everything You Download. Here’s How to Clear Download History.

1 minute read
| How-To

Your Mac has a history of everything you’ve ever downloaded, but it’s possible to clear it out. Viewing your Mac download history requires using the Terminal, so it’s unlikely most users would know how to do this. Here’s how to view and clear it.

Viewing Mac Download History

Here is a command that you can simply copy and paste into your Terminal to view your Mac download history:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'

This isn’t just Safari downloads. Any app that lets you download files will show up here. This can include torrents, cat photos, porn—anything. This happens because your Mac has used a Quarantine Manager since OS X Snow Leopard. It means that your Mac checks each download for safety issues, so you don’t unknowingly download a virus (although it could still happen.)

Terminal lets you view and clear download history.

Viewing the download history in Terminal.

Clear Mac Download History

Here’s how to delete the history. Again, this is command you can copy and paste into your Terminal:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'

However, your Mac will continue to keep a history, so you’ll need to run these commands every now and then if you want to clear it out.

Image of Automator task to clear download history.

What it looks like in Automator.

Automated Cleaning

As power users, we all like to automate things, so in order to have your Mac automatically clear its history, we can create a Calendar Alarm using Automator. In the sidebar, you can search for “Run AppleScript” and drag it into the work area.

do shell script "sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"

Copy and paste the above command into the window. Basically, you’ll just be replacing the default text that says (* Your script goes here *).

Image of an automatic event to clear download history.

Setting up an event in Calendar.

When you save the file, it will automatically create a separate Automator calendar in the Calendar app. This will of course be in the On My Mac section, and not an iCloud calendar. Saving the file will have it run immediately, and only once. But you can edit the event in Calendar to have it run on a specific schedule. I have mine run every Saturday at 11PM.

15
Leave a Reply

Please Login to comment
7 Comment threads
8 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
MOSiX ManAndrew OrrScott B in DC Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Member
rbramley

Unfortunately the listed commands don’t quite have the desired effect.
I was suspicious that the file size hadn’t changed, so opened it up in a text editor and the raw data was still present despite a zero result from count(*).

The additional command that is required is ‘vacuum’ to tell sqlite to rebuild the database file:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 ‘vacuum LSQuarantineEvent’

Member
Jason Lin

Fantastic find! I wouldn’t have thought to check this. Thanks for sharing the info and solution!

MOSiX Man
Member
MOSiX Man

Thanks for the info, but It appears that this may not work with High Sierra (public beta). I’ve tried…
sudo sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* ‘select LSQuarantineDataURLString from LSQuarantineEvent’, both with the V* and the V2 and, in both cases, nothing is returned. I haven’t been using any other means to clear my download history, so I’m sure that the data is there, somewhere.

Scott B in DC
Member
Scott B in DC

You have an error. There is a file com.apple.LaunchServices.QuarantineEventsV* (with the asterisk) that is empty. People need to replace the splat (asterisk) with a 2 so that it looks for the file com.apple.LaunchServices.QuarantineEventsV2. It is not a good style to rely on wildcards for system-related services. You should ALWAYS use exact file names. If the name has an asterisk I highly recommend that you should quote or escape it to make sure there is no ambiguity. After a little Google-fu, which I suggest when you write something like this, it appears that if there ever was a problem with the… Read more »

furbies
Member
furbies

Andrew, thanks for the tip, but perhaps you could try actually following your own instructions ?

Maybe my brain isn’t plugged in this morning ?
But the steps for creating a a Calendars event that runs the clear history script is missing steps / details ?

regards

furbies

vr8ce
Member
vr8ce

Fascinating. I didn’t find as much there as I would have expected. Does it maybe get cleared out after an upgrade (even a point upgrade)?

There is a timestamp column in the table that contains numbers that look like 452529740.633129. They don’t appear to be large enough to be Unix epoch’s, plus their is a decimal component which epochs usually don’t have. I can’t get strftime to return anything but NULL, no matter what options I try. Anyone know what that is and how to coerce a readable date/time out of it?

vr8ce
Member
vr8ce

Grrrr; “…plus there is a decimal component…”.

vr8ce
Member
vr8ce

Answering my own question: after a bit more searching, it appears that they are # of days, but they start at 2001-01-01 (initial date of OSX) instead of Unix’s epoch. Adding the # of days in-between allows datetime() to return a valid value. (I still don’t know what the decimal is all about, but it returns a date close enough to reality for my current purposes.)

Jamie
Member
Jamie

I’m getting the error in the terminal.

Jamie
Member
Jamie

Excellent, Andrew, but I keep getting a ‘too many options’ error. Any idea why that might be the case?