On OS X, the printing subsystem is CUPS.
- System Preferences > Printers & Scanners
- http://localhost:631/
sudo lpadmin
sudo lpadmin -d [printer]
sudo lpadmin -p [printer] -o auth-info-required=negotiate
You can eventually follow this article from Apple.
To change defaults, use this command: sudo lpadmin -p [printer] -o [option]=[value]
. For example: sudo lpadmin -p Follow-Me -o XRBannerSheet=None
Use lpoptions -p [printer] -l
.
Option | Values | Description |
---|---|---|
printer_is_shared | true/false | share printer |
auth-info-required | "none", "username,password", "domain,username,password", or "negotiate" (Kerberos) | set to negotiate to allow Kerberos |
media | Letter A4… | See here for more info |
XRBannerSheet | *None AtStart | On Xerox, displays the coverpage with Job ID |
More info here
This will allow you to make changes using a GUI, and find the right option.
- Open print dialog
- Create a preset
- execute
defaults read ~/Library/Preferences/com.apple.print.custompresets.forprinter.[printer].plist [preset] > before.txt
- Make changes
- Create a new preset
- execute
defaults read ~/Library/Preferences/com.apple.print.custompresets.forprinter.[printer].plist [new_preset] > after.txt
- See differences with
diff before.txt after.txt
I found it quite interesting to follow this:
lpoptions -p [printer] -l > before.txt
- Make the changes on http://localhost:631/printers/ > Printer > Set default Options
- Run
lpoptions -p [printer] -l > after.txt
- See differences with
diff before.txt after.txt
The command to install a printer is lpadmin
. You will need to specify:
-E
to Enable the destination and accept jobs-p [name]
: name of the printer-v [uri]
: path to the queue (smb://server/queue)-P [PPD]
: path to PPD (usually in /Library/Printers/PPDs/Contents/Resources/)-o [option]=[value]
: specify options
#!/bin/bash
#
# Installs printer, using Xerox Drivers (Xerox_Print_Driver_3.52.0.pkg)
#
readonly LPSTAT='/usr/bin/lpstat'
readonly LPADMIN='/usr/sbin/lpadmin'
readonly CUPSENABLE='/usr/sbin/cupsenable'
readonly CUPSACCEPT='/usr/sbin/cupsaccept'
#######################################
# Add printers using cups
# Globals:
# LPSTAT
# LPADMIN
# CUPSENABLE
# CUPSACCEPT
# Arguments:
# name
# uri
# ppd
# Returns:
# None
#######################################
add_printer() {
local name="$1"
local uri="$2"
local ppd="$3"
if ! ${LPADMIN} -E -p "${name}" \
-v "${uri}" \
-P "${ppd}" \
-o printer_is_shared=false \
-o auth-info-required=negotiate \
-o XRBannerSheet=None \
-o media=iso_a4_210x297mm; then
echo "ERROR: ${name}: Unable to lpadmin (add printer)" >&2
exit -1
fi
# cupsaccept and cupsenable are not needed before of '-E'. I don't remember why I included them.
if ! ${CUPSACCEPT} "${name}"; then
echo "ERROR: ${name}: Unable to cupsaccept." >&2
exit -1
fi
if ! ${CUPSENABLE} "${name}"; then
echo "ERROR: ${name}: Unable to cupsenable." >&2
exit -1
fi
}
if (! ${LPSTAT} -v "Follow-Me"); then
add_printer "Follow-Me" \
"smb://printserver.fti.io/Follow-Me%20Xerox%20(PCL6)" \
"/Library/Printers/PPDs/Contents/Resources/Xerox WC 7545.gz"
fi
exit 0