Skip to main content

Our users routinely snarf things up playing around with printers, trying to add home printers or change queue names to work with Printopia; or things just get hosed.



I'm working on a Self Service policy to blow away the printers and re-add all those scoped to the user. When I do this manually, I use the "Reseting printing system..." option accessed by right-clicking the printer list in the System Preferences pane.



Is there a way to invoke this action from the command line so that I could script it? In 10.4 and 10.5 there was a PrintingReset.sh script in the Printer Setup Utility bundle, but that tool is gone in later releases.



I'm aware that I can simply kill the queues via lpadmin and reset cupsd.conf, but I think the OS is doing a bit more to "fully" reset cups. If you watch the system log, clicking "reset printing system" invokes printtool (found at /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/printtool) but specifically what it's doing is a bit out of my depth.



Any thoughts?

This has stopped working on Ventura sadly... it's getting Killed:9 either when Jamf runs it, or even me with sudo.  Trying to find some solutions, but running into this still.


Some logs for good measure, we have a policy that resets printing system and then adds lab printers in a computer lab.

Executing Policy Mabpool Drivers and Queue Reset
Running script Reset Printing System...
Script exit code: 137
Script result: /Library/Application Support/JAMF/tmp/Reset Printing System: line 2: 72478 Killed: 9 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/printtool --reset -f
Error running script: return code was 137.

 

Any thoughts or suggestions are helpful!


Imagine the pain I feel at discovering this right *after* I finished upgrading a lab to Ventura. 😭
lmk if you find any solutions to this.


This has stopped working on Ventura sadly... it's getting Killed:9 either when Jamf runs it, or even me with sudo.  Trying to find some solutions, but running into this still.


Some logs for good measure, we have a policy that resets printing system and then adds lab printers in a computer lab.

Executing Policy Mabpool Drivers and Queue Reset
Running script Reset Printing System...
Script exit code: 137
Script result: /Library/Application Support/JAMF/tmp/Reset Printing System: line 2: 72478 Killed: 9 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/printtool --reset -f
Error running script: return code was 137.

 

Any thoughts or suggestions are helpful!


Are you running just the printtool command when you run it manually, or are you trying to run an entire script? I was able to run the printtool command on my macOS 13.2 device both with sudo and without and did not receive any errors.

I would look at your overall script. The error states it is failing at line 2. What is line 2 in the script?


Are you running just the printtool command when you run it manually, or are you trying to run an entire script? I was able to run the printtool command on my macOS 13.2 device both with sudo and without and did not receive any errors.

I would look at your overall script. The error states it is failing at line 2. What is line 2 in the script?


Hey, thanks for getting back!  Line 2 is as follows...

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/printtool --reset -f

EDIT:
I was running it as part of a script, and it was getting killed 9 in the script and when I ran it manually as sudo... but I just tried it on a system that has 13.2, and it did not kill it.  I'll try it again via the script and see what happens... maybe Apple fixed something?


Are you running just the printtool command when you run it manually, or are you trying to run an entire script? I was able to run the printtool command on my macOS 13.2 device both with sudo and without and did not receive any errors.

I would look at your overall script. The error states it is failing at line 2. What is line 2 in the script?


Sure enough, it is working now... it must have been broken in 13.1 as that is when I was noticing the printer lists weren't getting cleared as intended. 

@johntgecklooks like this is working now, my script is very simple and it as follows.  It looks like it requires 13.2 to work correctly, as it was failing before.

#/bin/sh
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/printtool --reset -f


Sure enough, it is working now... it must have been broken in 13.1 as that is when I was noticing the printer lists weren't getting cleared as intended. 

@johntgecklooks like this is working now, my script is very simple and it as follows.  It looks like it requires 13.2 to work correctly, as it was failing before.

#/bin/sh
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/printtool --reset -f


Sorry I am just getting back to this now, but I appreciate you tagging me! I'll give this a shot. :)


Reply