diff --git a/how-to-disable-cups-pinter-job-history-on-macos/README.md b/how-to-disable-cups-pinter-job-history-on-macos/README.md new file mode 100644 index 0000000..3e316c6 --- /dev/null +++ b/how-to-disable-cups-pinter-job-history-on-macos/README.md @@ -0,0 +1,83 @@ + + +# How to disable CUPS pinter job history on macOS + +## Requirements + +- Computer running macOS Monterey or Ventura + +## Setup guide + +### Step 1: clear job history + +> Heads-up: purges `/var/spool/cups`. + +```shell +$ cancel -a -x +``` + +### Step 2: create `/usr/local/sbin` directory + +```shell +sudo mkdir -p /usr/local/sbin +sudo chown ${USER}:admin /usr/local/sbin +``` + +### Step 3: create `cups.sh` script + +```shell +cat << "EOF" > /usr/local/sbin/cups.sh +#! /bin/sh + +set -e + +if grep -qe '^PreserveJobHistory Off$' /etc/cups/cupsd.conf; then + exit 0 +fi + +echo "PreserveJobHistory Off" | sudo tee -a /etc/cups/cupsd.conf + +launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist + +launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist +EOF +``` + +### Step 4: make `cups.sh` executable + +```shell +chmod +x /usr/local/sbin/cups.sh +``` + +### Step 5: create `local.cups.plist` launch daemon + +```shell +cat << "EOF" | sudo tee /Library/LaunchDaemons/local.cups.plist + + + + + Label + local.cups + + ProgramArguments + + /usr/local/sbin/cups.sh + + + RunAtLoad + + + +EOF +``` + +### Step 6: reboot