Show Download History List of All Files Ever Downloaded Within Mac OS X
Have you ever wanted to show a list of the entire download history of a Mac? Maybe you know you downloaded a file but you can’t quite pinpoint where you got it from and the “Get Info” trick didn’t work. Or maybe you are trying to track down a file that has been placed on a system that led to problems. Whether it’s for troubleshooting, personal interest, or forensics, the following command will show you everything that you’ve downloaded to a Mac regardless of the application that it came from:
How to View a List of All Files Downloaded to a Mac
This works by querying the file quarantine database of OS X, which is aimed at protecting Macs from malicious downloads. You’ll use the Terminal application and sqlite for this purpose.
- Launch Terminal from /Applications/Utilities/ and enter the following command into a single line:
- Hit return to see the list of downloaded files
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
Depending on how old the Mac is and how much stuff you’ve downloaded, it can take a while to query the database and dump the results. You may want to pipe the results through “sort” to group the downloaded list into similar items or sources, that would look like this:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent' | sort
For ease of viewing, you can also redirect the output into a text file, this command will dump the list into a file called “QuarantineEventList.txt” on the active users desktop:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent' > ~/Desktop/QuarantineEventList.txt
The output lists everything that has been passed through the Quarantine Manager, which for the last several versions of Mac OS X is quite literally every item downloaded to the Mac, regardless of the application it came from. Generally, the older the Mac is and the more files have been downloaded, the larger the list, and the longer the query can take to run.
Deleting the Download History List
For those who would rather not have an all-inclusive historical list of downloaded files, you can run the following command to delete the contents of the quarantine database:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
You can run that individually, or place it into .bash_profile or .profile to clear the database automatically when a new terminal window is launched.
This has been tested and continues to work in many versions of Mac OS X, from earlier versions through to OS X El Capitan (10.11.x+), OS X Yosemite, OS X Mavericks 10.9.5 and presumably newer. Let us know in the comments if you have success with this command and the version of OS X that you have used it with.
Thanks to Scott for the great tip, and thanks to Wiggums for the delete syntax.