privacy-guides/how-to-disable-cups-printer-job-history-on-macos
Carl P. Corliss b106fb2da9 Update CUPs Documentation to use cupsctl
Use `cupsctl`  to make cupsd config changes, and `lpstat -W completed -o` in a cronjob to ensure configured pruning.
2022-11-11 11:34:17 -05:00
..
macos-stores-a-copy-of-everything-one-prints-forever.jpeg Changed all typos of pint/pinter to print/printer. Not sure if that was an intentional spelling. 2022-11-10 14:48:51 -05:00
README.md Update CUPs Documentation to use cupsctl 2022-11-11 11:34:17 -05:00

How to disable CUPS printer job history on macOS

macOS stores a copy of everything one prints forever

Requirements

  • Computer running macOS Monterey or Ventura

Setup guide

Step 1: Reconfigure CUPS:

$  cupsctl MaxJobTime=5m PreserveJobFiles=no PreserveJobHistory=no

From cupsd.conf documentation:

MaxJobs number
Specifies the maximum number of simultaneous jobs that are allowed. Set to "0" to allow an unlimited number of jobs; the default is "500".
MaxJobTime seconds
Specifies the maximum time a job may take to print before it is canceled. Set to "0" to disable cancellation of "stuck" jobs. The default is "10800" (3 hours).
PreserveJobFiles Yes | No | 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 | No | 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".

Step 2: clear job history

Clear out any completed jobs using the new settings from Step 1 (note: this does not affect any active jobs in the queue)

$ lpstat -W completed -o

Step 3: Setup cronjob to clear out jobs

Note: Jobs should automatically be purged upon completion if you're using the settings above, but may persist in some specific cases (e.g., if cups is restarted in the middle of a job, see this). This cron job will ensure that any jobs that persist are cleaned out using the PreserveJobFiles and PreserveJobHistory settings you defined in Step 1:

if ! crontab -l 2>/dev/null | grep -q CUPS-QUEUE-PURGE; then
	crontab <(crontab -l 2>/dev/null; echo -en "\n# CUPS-QUEUE-PURGE: ensure that print jobs are cleaned out after they're expired\n* * * * * /usr/bin/lpstat -W completed -o")
fi

👍


Want things back the way they were before following this guide? No problem!

Step 1: Reset config parameters to defaults

$  cupsctl MaxJobTime= PreserveJobFiles= PreserveJobHistory=

👍