![]() Use `cupsctl` to make cupsd config changes, and `lpstat -W completed -o` in a cronjob to ensure configured pruning. |
||
---|---|---|
.. | ||
macos-stores-a-copy-of-everything-one-prints-forever.jpeg | ||
README.md |
How to disable CUPS printer job history on macOS
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
andPreserveJobHistory
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=
👍