Did you know the macOS Printer service (Common UNIX Printing System, or CUPS) keeps a copy of every single print job ever? Here’s how to change this default behaviour.

Sun Knudsen’s video and accompanying post, How to disable CUPS pinter job history on macOS, brought this to my attention. However his post was not thorough and suggested a less-than-optimal configuration method.

Also, back in 2017, I posted about using the CUPS web interface to set printer defaults. You might want to check that out too!

Background

To summarize the issue, macOS stores print job control files (prefix c) and print data files (previx d) files in /var/spool/cups. The default configuration keeps these files forever - not ideal from a secuitiy/privacy point of view and consumes disk space unnecessarily.

Danger! You need administrator permissions to interact with this folder (sudo). Please do not do anything you do not understand. As usual, never execute commands blindly... even what I show here.

In my case, all print jobs are PDFs, so it would be trivial to replay my print history. To validate, one could do a file /var/spool/cups/d* to determine the file type.

sudo sh -c 'file /var/spool/cups/d*'

/var/spool/cups/d00001-001: PDF document, version 1.3, 1 pages
/var/spool/cups/d00002-001: PDF document, version 1.3, 4 pages

Before proceeding, please review CUPS settings via man cupsd.conf or the cupsd.conf documentation:

PreserveJobFiles Yes
PreserveJobFiles No
PreserveJobFiles seconds
Specifies whether job files (documents) are preserved after a job is printed. If a numeric value is specified, job files are preserved for the indicated number of seconds after printing. The default is "86400" (preserve 1 day).
PreserveJobHistory Yes
PreserveJobHistory No
PreserveJobHistory seconds
Specifies whether the job history is preserved after a job is printed. If a numeric value is specified, the job history is preserved for the indicated number of seconds after printing. If "Yes", the job history is preserved until the MaxJobs limit is reached. The default is "Yes".

Configuring CUPS at Runtime

The easiest method to change the configuration is to run this from the command line or via shell script:

cupsctl PreserveJobFiles=No PreserveJobHistory=No

This command automatically saves the configuration to /etc/cups/cupsd.conf. Run cupsctl without any arguments to confirm your settings.

Editing CUPS Configuration File

Alternatively, edit the configuration file directly, e.g. sudo vi /etc/cups/cupsd.conf. Assuming you have no existing PreserveJob* entries, then just add you configuration to the end of the file, e.g.

PreserveJobFiles 86400
PreserveJobHistory 86400

Save then restart CUPS:

sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist