# Troubleshooting printer detection in Mac OSX 10.5

Starting with Mac OSX 10.5 Apple changed the default way it listens for printer adverts, and the same is true in OSX 10.6. As a result the printing system will no longer see the standard CUPS/IPP printer adverts from the laptop network print server. Therefore by default no shared printers show up in the list when you try to add one.

This change in behaviour also stops it seeing printers advertised by Macs running older versions of Mac OSX and so this causes problems for many people.

To correct the problem a change needs to be made (once) to the cups configuration.

Note that upgrading Mac OSX version (e.g. from 10.5 to 10.6) will usually undo the change. Using the Reset Printing System feature will certainly undo the change.

Apple used to have a helpful Support Article about this but removed it in March 2010. That article advised people to run the following command in a terminal:

  cupsctl BrowseProtocols='"cups dnssd"'



Please note the nested quotes in the command!

This tells the Apple cups server to listen for standard CUPS/IPP printer adverts or use DNSSD (Bonjour) - by default on Mac OSX 10.5/10.6 it only uses the latter.

The lapnet print server only sends out CUPS/IPP adverts - just like older versions of Mac OSX did - so the same change is needed to see our printer adverts.

Once the command has been run your Mac should start to see the CUPS/IPP printer adverts. Within 30-120 seconds it should have picked up all our printers. The next time you add a printer you should see them all.

## Freezing of Printing Preferences and/or other OSX features

A few applications (or dummy printer setups such as (some versions of) Adobe Distiller) seem to prevent the cups daemon from working once the required change has been made. If you have one of these then after running the cupsctl command cupsd to fail to run and applications like Systems Preferences may become unresponsive. To work round this you need to manually fix the configuration - since access via the usual cupsctl or GUI mechanisms will not work.

If there are "freezing" problems after making the change (cupsctl command, above) then removeing old printer definitions usually cures it. Run the following in a Terminal:

  sudo mv /etc/cups/printers.conf /etc/cups/printers.conf.BAD
sudo killall cupsd



If launchd does not automatically restart cupsd after killing it, you may need to tell it to unload/load the cups configuration again, e.g. with:

  sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist



If renaming the printers.conf file fixes things then you may want to read through the old file to track down which printer definition caused the problem. Note that manually editing printers.conf may not always work since cupsd re-writes this file itself. Let us know if you need help with this.

## Apple Firewall blocking IPP

If you have the Apple Firewall set to (OSX 10.5) Allow only essential services or (OSX 10.6) Block all incoming connections then it will block the IPP printer advertisements, and so you will see no printers at all

To test if this if the problem try disabling the firewall, if that works you should be able to re-enable it with slightly less strict rules to allow cups to see the printer adverts.

The configuration options are under Advanced in the Firewall tab (From System Preferences select Security and then the Firewall tab).

The settings are different on OSX 10.5 compared to 10.6. For OSX 10.6 allowing Automatically allow signed software to receive incoming connections seems to be sufficient to allow cupsd to work.

See Apple's article about the Firewall settings for details.

## Odd lists of printers when trying to print

Normally apps should show only the printers that you have added (with + or using the Add Printer options, but sometimes it seems to get confused and shows a seemingly random set of printers as well.

If this happens it seems to help to clear out some of the caches, running in a Terminal:

  sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
sudo rm -rf /var/spool/cups/cache/* /Library/Preferences/org.cups.printers.plist



This stops cupsd, removes the caches and then starts it again. The cache files will be regenerated over the next few seconds - up to 120 seconds to get a complete list.

You can see the current list of favourite printers by running in a Terminal:

  FAV=~/Library/Preferences/com.apple.print.favorites.plist
/usr/libexec/PlistBuddy -c print \$FAV



Apple seem to provide no obvious way to remove printers from this list since OSX 10.6.

## More troubleshooting

If you still do not see printers then here are some troubleshooting steps which you can try. In a terminal window run:

  grep -i '^browseprotocol' /etc/cups/cupsd.conf
/usr/bin/lpstat -v
/usr/sbin/netstat -p udp | grep ipp
sudo /usr/sbin/lsof -i udp:ipp



If things are working as expected the lpstat command will show a long list of printers, and the netstat command will show something like:

  udp4       0      0  *.ipp                  *.*



and the lsof command ought to report something a bit like:

  COMMAND PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
cupsd    25 root    8u  IPv4 0x1913d98      0t0  UDP *:ipp



On rare occasions some other service may have already chosen to use the CUPS/IPP udp-port (631). If this happens the cups server will be unable to see our printer adverts and you will see no printers. That can usually be corrected by simply restarting the machine.

If things still do not work please let us know and if possible include the contents of the files /etc/cups/cupsd.conf and /etc/cups/printers.conf and the result of running the lpstat, netstat and lsof commands mentioned above.

The cupsctl command only needs to be run once - unless you change it or reset the printing system settings.