Skip to content

Instantly share code, notes, and snippets.

@jacobsalmela
Forked from rmanly/unshare_all_printers.bash
Last active August 20, 2022 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jacobsalmela/b5ee1b54366400168788 to your computer and use it in GitHub Desktop.
Save jacobsalmela/b5ee1b54366400168788 to your computer and use it in GitHub Desktop.
Unshares printers and disables Printer Sharing
#!/bin/bash
#while read -r _ _ printer _; do
# /usr/sbin/lpadmin -p "${printer/:}" -o printer-is-shared=false
#done < <(/usr/bin/lpstat -v)
# Slightly faster when there are a lot of printers
lpstat -p | grep printer | cut -d" " -f2 | xargs -I{} lpadmin -p {} -o printer-is-shared=false
# Also disable Printer Sharing in the Sharing pane
cupsctl --no-share-printers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment