How can I open a printer queue using Terminal?

How can I open a printer queue using Terminal?


I have found plenty of information on the internet on how to install a printer, delete a printer, control attributes of the document being printed, view the contents of a print queue, clear a print queue, delete a print queue, cancel all printing, etc, etc., using Terminal commands which involve lp, lpd, lpadmin, lpq, lpoptions, and so on. But I have not been able to find one which actually opens the print queue just as if I had clicked on the "Open Print Queue…" button in the Printers & Scanners pane of System Preferences.


I am working on an AppleScript which, amongst other things, installs a printer using a shell script and then opens the printer queue by telling Finder to open the printer app (eg HP4100.app) which is created in ~/Library Printers. I have discovered that this app is created the first time the print queue is opened after a printer is installed. Manually, you would do this in the Printers & Scanners pane of System Preferences by clicking on the button "Open Print Queue…" and Voila!, the printer.app is created. I need/would like to be able to achieve the same result programmatically, either in pure AppleScript or preferably by using a shell script within AppleScript - namely, a shell script installs the printer and then the printer queue is opened - BEFORE this printer.app is created. Opening the queue by any method will actually create the printer.app, but I need a way to open the queue if the printer.app is not there yet.


Any suggestions, thoughts, ideas would be gratefully accepted. I know nothing about C, C++, Python, Ruby, etc., so I will not be able to implement any solutions in those languages unless there is a really simple way of doing it which does not assume any prior experience with using those languages.

iMac, macOS Sierra (10.12.6), mid-2011, 3.4GHz i7, 27in, 32GB RAM

Posted on Oct 31, 2018 12:10 AM

Reply

Similar questions

2 replies

Nov 2, 2018 8:37 PM in response to Steven Jones

More information:


Apart from clicking on the "Open Print Queue…" button in the Printers & Scanners pane of System Preferences, another way of creating the printer queue app in the ~/Library/Printers folder is to drag the printer icon (in the list of printers in the left part of the pane) to the desktop. This creates an alias on the desktop and creates the printer.app as the moment you start dragging. Right-clicking on the printer icon lists only three available actions which are Rename printer, Set default printer and Reset printing system, none of which is relevant.

I am trying to discover what System processes are being triggered by these GUI actions (clicking, dragging) with the hope of being able to trigger them myself by way of scripting.

I have tried various Terminal scripts such as lp -d Printer_Name File_Name but this does not actually open or create the printer queue. It results in the printer being paused until such time as I manually open the printer queue and click Resume or delete the print job.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I open a printer queue using Terminal?

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