Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A comprehensive script for to remove broken printers System
If you have difficulties printing, sometimes it's best to just start over from scratch with your printer setup. The following script makes that easy, as it deletes all the various drivers and settings files from your machines. The script must be run as root of course, eg:
sudo scriptname.sh
Read the rest of the hint for the script...

#!/bin/sh
# Set the Username from the $USER Variable
export USERNAME=$USER

# Delete the preferences from the main library folder.
rm -f /Library/Preferences/com.apple.Print.*

# Delete the preferences from the users library folder.
rm -f /Users/$USERNAME/Library/Preferences/com.apple.Print.*

# Don't forget the ByHost directory
rm -f /Users/$USERNAME/Library/Preferences/ByHost/com.apple.Print.*

# Delete the printers directory, this will delete all your printers drivers.
rm -Rf /Library/Printers

# Delete the users Printers folder, this will delete the desktop printer icons.
rm -Rf /Users/$USERNAME/Library/Printers

# Delete the HP Directory in the Applications Folder
rm -Rf /Applications/Hewlett-Packard

# Delete the HP Directory in the Applications/Utilities Folder
rm -Rf /Applications/Utilities/hp

# Delete the hp printer selector
rm -Rf /Applications/Utilities/hp printer selector

# Remove the temporary Printers directory
rm -Rf /tmp/printers

# Remove the printcap file
rm -Rf /etc/printcap

# Remove the users printcap file
rm -Rf ~$USERNAME/.printcap

# Remove the printers.conf file
rm -Rf /etc/cups/printers.conf

# Remove the classes.conf file
rm -Rf /etc/cups/classes.conf

# Delete the /var/spool/cups directory, this will delete all your queues
rm –Rf /var/spool/cups

# Make the /var/spool/cups directory
mkdir –p /var/spool/cups/tmp

# change the ownership of the cups directory, don't forget to make it recursive
chown –R daemon:admin /var/spool/cups

# Change the file access permissions to 700, if you are bored, change to 722, or 744
chmod 700 /var/spool/cups

diskutil repairPermissions /
[robg adds: After running this, of course, you'll need to reinstall your printers, so make sure you have the drivers handy before you try this fix. I haven't tested this script, since my printers are working fine. If you happen to try it, plesae post a comment regarding its success or failure...]
    •    
  • Currently 1.75 / 5
  You rated: 4 / 5 (4 votes cast)
 
[13,422 views]  

A comprehensive script for to remove broken printers | 6 comments | Create New Account
Click here to return to the 'A comprehensive script for to remove broken printers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A comprehensive script for to remove broken printers
Authored by: LC on Jan 08, '04 01:38:03PM

It may be also worth mentioning for some readers that they can try
a utility called "Printer Setup Repair" (a shareware app from
John Goodchild) I had some benefit from it (for example, getting
the "Show Jobs" dialog to work;) Larry.



[ Reply to This | # ]
A comprehensive script for to remove broken printers
Authored by: seann on Jan 08, '04 07:29:48PM

Also there seams to be a forked version of this located at: http://printsetupaid.sourceforge.net

Called Printer Setup Aid.


direct link: http://printsetupaid.sourceforge.net/tools/PrintSetupAid.dmg



[ Reply to This | # ]
A comprehensive script for to remove broken printers
Authored by: LC on Jan 09, '04 11:38:45AM

A sudo for each and every shell line ... hmmm, one could also sudo a self re-exec, or a temp file (or a here doc into sh);



[ Reply to This | # ]
A comprehensive script for to remove broken printers
Authored by: seann on Jan 09, '04 05:12:33PM

I think it's done that way so you can copy and paste a line out of the script if you just want to do that part.



[ Reply to This | # ]
A comprehensive script for to remove broken printers
Authored by: Gabs on Mar 28, '04 01:08:07PM

Good stuff - Printer Setup Aid (as it now is) from Sourceforge sorted out my problems with an HP DeskJet 5550 (again). Seems to have left my virtual printer for Acrobat (which still runs in classic) and the Page Sender Fax print software untouched. Good stuff. Messed up permissions though - could not reinstall the drivers - until Disk Utility was run to fix 'em but that is easily done.



[ Reply to This | # ]
PrinterSetup
Authored by: lucidsystems on Aug 29, '06 03:52:08AM
You may want to look at a script which is bundled with PrinterSetup.

[ Reply to This | # ]