Configuring network printers from the command line

Configure network printers via command line on Macs

Add a printer

lpadmin -p "Advertising-ir4251" \
-v "socket://165.778.125.47" \
-L "2nd Floor" \
-P "/Library/Printers/PPDs/Contents/Resources/en.lproj/CNADV4245X1.PPD.gz" \
-E

List the printer options

lpoptions -p "Advertising-ir4251" -l

Set some options
Example - this printer has an inner 2-way tray and we want to disable the default duplex printing:

lpoptions -p "Advertising-ir4251" \
-o OptFIN=IN2TRAY \
-o Duplex=None

This article pointed out something interestin, that "if you setup the printer using lpadmin without any options, and later use lptoptions to set the options, they are not written to the PPD and the GUI is unaware of the printer's options.", so to set up this printer, change the default options, AND have them properly reflected in the GUI:

lpadmin -p "Advertising-ir4251" \
-v "socket://165.778.125.47" \
-L "2nd Floor" \
-P "/Library/Printers/PPDs/Contents/Resources/en.lproj/CNADV4245X1.PPD.gz" \
-o OptFIN=IN2TRAY \
-o Duplex=None \
-E

Recent Updates

  • 5 days 4 min ago
    1.27.2 update
  • 2 weeks 2 days ago
    Drupal 10/11 config
  • 2 weeks 3 days ago
  • PHP
    2 weeks 3 days ago
    PHP 8.3.11 and AlmaLinux
  • 2 weeks 4 days ago
    New version of Pound