If you are having difficulty configuring your printers or even just printing to them in OS X, one thing to try is to, which will clear out your printers and allow you to set them up again from scratch. This service may appear to only remove your printers, but it in fact does a number of checks on the system and restores configuration files to factory defaults.
As part of its PrintCore framework, Apple includes a small program called "printtool" (buried in the /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/ directory) which runs as a background process; when you instruct the system to reset the print system, this process is launched and performs the following routines:
- First it creates a new, empty version of the installed printers property list, called "InstalledPrinters.plist" in the /Library/Printers/ folder. This process starts with the system creating an empty standard XML property list file called "InstalledPrinter.plist.new," and then renames the current printer list with the extension ".bak" to preserve it as a backup. It then removes the ".new" from the name of the empty property list to make it the current working version.
- The working configuration file or the CUPS service is called "cupsd.conf" and is stored in the /private/etc/cups/ folder. However, the system keeps a factory-default version of this file called "cupsd.conf.default" in the same folder as the working configuration file.
Similar to the way the "InstalledPrinters" property list is managed, the system first copies the this default configuration file to a new temporary file called "cupsd.conf.new," then it appends the ".bak" extension to the the current configuration file to preserve it as a backup. It finally removes the ".new" extension from the temporary file to make it the working CUPS configuration.
Both of these steps effectively reset the print system, but to ensure proper access to the resources the printer needs, printtool continues to do the following:
- Runs a permissions and ownership check on the following CUPS system folders to make them owned by the root user and "wheel" group, and that these directories and all files within them inherit the same ownershipt as well as are both readable and executable by all users:
This process can effectively be done by running the following two commands:
sudo chown -R root:wheel /Library/Printers
sudo chown -R root:wheel /usr/libexec/cups
Following these, the permissions can be set with the following two commands:
sudo chmod -R 755 /Library/Printers
sudo chmod -R 755 /usr/libexec/cups
If it seems as though resetting the print system is taking a while, it is likely because of this step; it simply takes time for the system to check every printer driver you have installed. This will especially be true if you have installed numerous driver packages manually from Apple's Web site.
- Next, the printer reset routine creates a new sandbox configuration file in the /private/tmp/ folder. This will be a file with a ~13-character alphanumeric name that contains sandbox-related rules for printer access to the spool directories, driver files, and user directories, among others.
- The cups local certificates directory at /private/etc/cups/certs is then recreated so print jobs can be properly authenticated.
- The final modification updates the sandbox cache in a system-defined subdirectory of the /private/folders/ directory.
After these steps, the system preferences printer list will be refreshed to reflect the changes, which should show an empty list, as the printer setup is reset to factory defaults. But if you somehow have mistakenly reset the print system, you can easily undo these changes simply by restoring the two configuration files from the backups mentioned in steps 1 and 2 above. This can be done by opening the Terminal and running the following two commands:
sudo mv /etc/cups/cupsd.conf.bak /etc/cups/cupsd.conf
sudo mv /Library/Printers/InstalledPrinters.plist.bak /Library/Printers/InstalledPrinters.plist
After performing these steps, restart the system and your previous printer configuration should be fully restored.