Bash Script: Fix Paused Printers In OS X

You need an administrator password to un-pause a printer in OS X.  It is possible to add a user to the lpadmin group.

sudo dseditgroup -n /Local/Default -o edit -a username lpadmin

This will give them rights to the printer, but if your users aren’t admins of their machines, this might not be something you want to open up.  This is the case for the school I work at.  My solution was to create a LaunchDaemon that would automatically detect and un-pause paused printers.

This is the Launch Daemon stored in /Library/LaunchDaemons

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

And this is the script that will run every 1800 seconds (per the StartInterval  above).

# If no disabled printers exist
if [ -z $(lpstat -p | awk '/disabled/ {print $2}') ] &> /dev/null;then 
echo "DISABLED: Something is wrong with the printer(s)..."
for printer in $(lpstat -p | awk '/disabled/ {print $2}')
# Cancel all jobs (and their files)--disable/enable CUPS as well
cancel -ax
cupsdisable $printer
cupsenable $printer
echo -e "\tFIXED $printer"


Leave a Reply