Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Add a network printer with command line

Windows Environment and Windows Printer Server.

When I add a printer to the MAC users using the GUI this is what I do:

  • System Preferences
  • Printers & Scanner
  • Unlock the lock
  • Type the administrator credentials
  • Press the + sign
  • Select the IP Tab
  • Fill the Address box e.g. 10.1.20.12
  • I select Add and OK
  • I lock again the lock

How can I achieve the above process with the terminal command line?

Thank you so much

MacBook Pro with Retina display, OS X El Capitan (10.11.6)

Posted on Feb 23, 2017 1:03 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 23, 2017 2:31 PM

Hi Fabio,

This can be done via the lpadmin command. To add a printer, use this format:

lpadmin -p Printer_Name -L "Printer Location" -E -v ipp://10.1.20.12 -P /Library/Printers/PPDs/Contents/Resources/Printer_Driver.gz


replace "Printer_Driver.gz" with the appropriate driver.


Hope this helps

8 replies
Sort By: 
Question marked as Top-ranking reply

Feb 23, 2017 2:31 PM in response to fabio168

Hi Fabio,

This can be done via the lpadmin command. To add a printer, use this format:

lpadmin -p Printer_Name -L "Printer Location" -E -v ipp://10.1.20.12 -P /Library/Printers/PPDs/Contents/Resources/Printer_Driver.gz


replace "Printer_Driver.gz" with the appropriate driver.


Hope this helps

Reply

Feb 27, 2017 11:28 AM in response to Andbrowny

Hi Andbrowny, and thank you so much to take your time to replay my post.


Do I have to type the -P /Library/Printers/PPDs/Contents/Resources/Printer_Driver.gz ????


I just typed the following command below but nothing is happing. I do not see any printer added to my system preference printer and scanner.


The command line does not give me any error message, it just accept my command line


lpadmin -p Printer_Name -L "Printer Location" -E -v ipp://10.1.20.26

Reply

Feb 27, 2017 2:19 PM in response to fabio168

Hi again fabio,

When you add the printer manually, what driver/ppd does it use?

try this

lpadmin -p Test_Printer_Name -L "Printer Location" -E -v ipp://10.1.20.26 -P "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks /PrintCore.framework/Versions/A/Resources/Generic.ppd"

This is one line and It is using the generic ppd so it may or may not work.


thanks

Reply

Feb 27, 2017 3:21 PM in response to Andbrowny

when i run the command now i receive these two error messages:


lpadmin: Unable to open PPD “/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks /PrintCore.framework/Versions/A/Resources/Generic.ppd”: Unable to open PPD file on line 0.


lpadmin: Unable to open PPD file “/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks /PrintCore.framework/Versions/A/Resources/Generic.ppd” - No such file or directory


about your question: When you add the printer manually, what driver/ppd does it use?

The printer it is located on a windows printer server, so I do believe it takes the whatever driver are installed for that printer in the server OR it just automatically find a generic drive online during the installation

Reply

Feb 27, 2017 3:35 PM in response to fabio168

I am not sure why this is not working, I have tested this on both 10.11 and 10.12.

in terminal can you run this command?

open /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks /PrintCore.framework/Versions/A/Resources/


does it give you the same error?

Reply

Add a network printer with command line

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.