Skip to content

Retrieve all files ever printed on a Mac computer! Show mac print history.

License

Notifications You must be signed in to change notification settings

adam-sroka/mac-retrieve-printed-files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Retrieve Printed Files on Mac 🖨🗂

What is this?

This script will retrieve information (e.g. name, time of printing) about all files ever printed on your Mac1, and possibly also the original files, even if they've been deleted.

How do I do it?

Download this repository from here, unzip it, open up terminal in the folder with it, and run the python script as root, i.e. run:

sudo python retrieve_printed_files.py

This will create a new folder with all retrieved files and a csv file with information about every file ever printed, even if the file itself could not be recovered.

Security sidenote

Root privileges are needed to access the protected directory where the print history is stored. Feel free to examine the python script before running it; it's only about a hundred lines.

Alternatively, you can also run the bare-bones shell script from this repo, which only has four commands and just copies the whole folder with the print history and tries to rename the files to pdfs. Do so by running sudo bash retrieve_files.sh.

How does this work?

MacOS uses a printing system called CUPS, which is configured to save printed files by default in many cases. This means that if you print a file on your Mac and then delete it, it is likely that Mac has saved a copy of that file in an internal CUPS folder. This script just copies that file back, finds its name, renames it, and also retrieves some other information from CUPS control files. You can read more in my blog about this.

Acknowledgements

Thanks for go-cups-control-files and for How to dissect a CUPS job control file; this would not exist without these.

License

The scripts are licensed under the GNU General Public License v3.0.

Footnotes

  1. And also on any other Linux system using CUPS, Apple's open-source system for printing.