MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Thu, Aug 07, 2014 10:47 pm

Adding a printer from the command line on an OS X system

While in someone else's office, I needed to add an HP Color LaserJet CP4025 printer in that office to the list of available printers on my MacBook Pro laptop. I was able to generate a printout of the printer's configuration from its front panel to get its IP address. I then looked for a suitable Postcript Printer Description (PPD) file on the laptop. The PPD files can be found in /Library/Printers/PPDs/Contents/Resources.

$ ls /Library/Printers/PPDs/Contents/Resources | grep -i LaserJet | grep 40
HP Color LaserJet CM4540 MFP.gz
HP Color LaserJet CM6040 MFP.gz
HP Color LaserJet CP4005.gz
HP Color LaserJet CP4020 CP4520 Series.gz
HP LaserJet 400 M401.gz
HP LaserJet 400 M401dne.gz
HP LaserJet 400 MFP M425 Fax.ppd.gz
HP LaserJet 400 MFP M425.gz
HP LaserJet 4000 Series.gz
HP LaserJet 4050 Series.gz
HP LaserJet 4240.gz
HP LaserJet 9040 9050 MFP.gz
HP LaserJet 9040.gz
HP LaserJet M9040 M9050 MFP.gz
HP LaserJet P4010_P4510 Series.gz

The HP LaserJet 4000 Series.gz file seemed appropriate. I then used the command below to add the printer:

$ lpadmin -p "" -v "lpd://" -D "Matt - HP CP4025" -L "Building 18 Room S188" -P "/Library/Printers/PPDs/Contents/Resources/HP LaserJet 4000 Series.gz" -E

The printer then appeared in the list of available printers under System Preferences/Print & Scan and I was able to print to it.

The lpadmin command can be used to configure CUPS printers. CUPS is a modular printing system often found on Unix and Linux operating systems. Apple's OS X opertaing system is a Unix-based graphical interface.

The options for the lpadmin command, which can be used to configure CUPS printers, are listed below:

    -p = Printer name (queue name if sharing the printer)
    -v = IP address or DNS name of the printer
    -D = Description of the printer (appears in the Printers list)
    -L = Location of the printer
    -P = Path to the printer PPD file to use for the printer
    -E = Enable this printer to accept print jobs

The text specified with the -D option is the description that I see for the printer when I check Print & Scan under System Preferences.

Print and Scan printers

[/os/os-x] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo