Archive for January, 2015

Sharing a Printer from Mavericks to Windows

January 14, 2015

Every few years I have to figure out a new way to share a Mac’s printer with Windows PCs. The printer is connected to a Mac with USB and shared using System Preferences>Sharing>Printer Sharing.

Apple provides Bonjour Print Services for Windows as a free download. It starts a service that discovers printers using the Zeroconf protocol, of which Apple’s implementation is called Bonjour (formerly Rendezvous before they lost a trademark dispute). It works great on Windows XP. But on Windows 7, Apple’s Bonjour service (as of version 2.0.2, which hasn’t been updated in years) is flaky, spewing tons of error messages to the event log and frequently losing the connection to the printer. I had to give up on it (and that’s without a Windows firewall getting involved).

When the Mac with the printer was running Snow Leopard (10.6), I could add the printer on Windows 7 using Control Panel>Hardware and Sound>Devices and Printers>Add a printer>Add a local printer>Create a new port>LPR Port and then entering the hostname or IP address of the Mac and the CUPS printer queue name (which the lpq command in Terminal shows). Snow Leopard shares the printer using the Unix LPD (also called LPR) protocol, among others.

When I upgraded the Mac to Mavericks (10.9), I found that it wasn’t listening on the LPD port. After a lot of research, I discovered that support for LPD printer sharing is included in Mavericks but disabled by default. Here is how to enable it.

Open a Terminal window.

sudo launchctl load -w /System/Library/LaunchDaemons/org.cups.cups-lpd.plist

Type your password. Your Mac should now be listening on the LPD port. If you have its firewall enabled in System Preferences, you might need to open the LPD printer port (TCP port 515) in the firewall. Now printing to it from Windows should work.

The load -w option forces the service to be enabled. If you want to more clearly mark it as enabled, you can:

sudo bash

Edit /System/Library/LaunchDaemons/org.cups.cups-lpd.plist using a text editor like vi or nano.

Under the Disabled key, change the “true” to “false”, then save the file and exit the editor.

All of this probably applies to Yosemite (10.10) too, but I haven’t tested that, or Windows 8 or Vista.