Printing to Windows from MAC OSX 10.2 (Jaguar) using CUPS and SAMBA

 

Keywords – how to, print, windows, mac osx, macosx, mac os x

Introduction:

 

This document provides detailed step by step instructions and diagnostics that will allow any Mac running CUPS and SAMBA (Jaguar OSX 10.2 or later) to print to printers shared by Windows computers. It assumes familiarity with the Terminal. This document may be found at http://homepage.mac.com/william_white/print_to_windows.html

 

For printing from Windows to a printer shared on a Mac computer, see the corresponding document at http://homepage.mac.com/william_white/print_to_samba.html

 

Shortened versions of these documents can be found on the Apple Discussion Forums under the User-submitted Frequently Asked Questions:

 

How to Print to Windows using CUPS and SAMBA

How to Print to OSX 10.2 from Windows

 

Since the 03-24-03 security update, the smbclient and smbspool commands are broken. Printing to Windows relies on smbspool. Unfortunately, smbspool is still broken in 10.2.5 and 10.2.6.

 

This can be fixed by installing the prior versions of both which can be found in my file sharing area at http://homepage.mac.com/william_white/FileSharing3.html .  After downloading smbspool, you need to copy it to the /usr/bin folder as root. You do this logged in as root, either from the GUI, logged in as root, or you can do it from the terminal. Make sure the binary ends up with the correct ownership (root:wheel) and permissions (owner = read/ write/ execute, group and others = read/ execute). Also, see http://www.macwindows.com/jaguar.html - 033103 for a great deal of background and various step-by-step information.

 

Prior to attempting to share printers, it is advised to first be able to share files. See the Apple site for KB articles on Windows File Sharing. For advanced help with Windows file sharing and diagnostic tools see http://homepage.mac.com/william_white/smbdoc.html.

 

The procedure was originally devised and tested with an Epson 740i Color Stylus USB printer attached to a Windows 2000 Pro laptop. Client access to this printer was tested from a PowerMac G4/450 MHz and a PowerBook G4/500 MHz with OSX 10.2.4 installed on both Macs. Subsequently, the PowerBook has been used to connect to other shared Windows printers, mostly varieties of HP printer such as Color Laserjet 4000 and 5000 series, and recently a Xerox Document Center 432 using the Xerox (postscript?) “PS2” drivers that come with OS X.

 

This procedure has also been tested from a Mac OSX 10.2.6 client (with 10.2.4 smbspool) and Apple PS Driver to a Mac OSX 10.2.6 system hosting an Epson C82 printer exported using SAMBA!

 

Once the initial Mac setup steps in Sections 1 and 2 have been undertaken, you will be able to print to almost any printer shared by almost any Windows machine. The main limitation is whether suitable drivers are available for the Mac. For that, we depend heavily on the gimp-print drivers and esp ghostscript software.

 

The following conventions are followed in this document:

 

“sharedprinter” is the Windows shared printer name.

 

“servername” is the network name of the Windows PC.

 

“workgroup” is the workgroup name or domain name of your PC and Mac computers

 

“username” and “password” are the username and corresponding password on the target Windows machine or as registered in an NT Domain.

 

Overview:

1. Link the CUPS backend SMB filter to the smbspool command.

2. Install ESP Ghostscript and/or gimp-print drivers.

3. Install and share a printer on the PC.

4. Add the windows printer from Print Center using the Advanced option.

5. Troubleshooting and further help.

 

1. Link the CUPS backend to the smb spooler.

 

This step is only ever required once. Recheck the link after an OSX upgrade or install (see step 4.3 for instructions how).

 

1.1        In the Mac Terminal (The Terminal may be found under /Applications/Utilities in OS X): type the following command as a user with administrative privileges

 

sudo ln -s /usr/bin/smbspool /usr/libexec/cups/backend/smb

 

Answer “yes” to any lesson about do you know what you're doing, and enter your admin password when prompted. If you're unsure of the command, copy the above text string and paste it into the Terminal window. There is no informative message if the command is successful, just a new Terminal command prompt. Type exit.

 

1.2.      Make sure Windows File Sharing is enabled in the System Preferences Sharing pane.

 

2. Install Ghostscript and Gimp-print.

 

This step is only ever required once. Although checking the site for new drivers is recommended.

 

2.1.      It is generally necessary to install the ESP Ghostscript 7.05.5 software for Mac OS X. Without that, print jobs may appear to print to the PC, but very slowly, and don't actually print after queueing. ESP (Easy Software Products) is the organization that distributes the CUPS Open Source printing system that is included in MAC OSX 10.2 (Jaguar).

 

Find the download links and comprehensive documentation at the gimp-print site here:

 

http://gimp-print.sourceforge.net/MacOSX.php3

 

You may want both the gimp-print drivers and the espgs software.

 

2.2.      Restart the Mac computer so that the CUPS daemon reloads printer information.

 

3. On the PC: Install and share a printer.

 

These steps are only required to set up a shared Windows printer. If you want to connect your Mac to an existing shared printer, go directly to section 4.

 

3.1.      Connect the printer to the PC and install any required drivers. In the PC Printer Properties Sharing tab select “Share this Printer” and provide the name that will be seen by other computers on the network.

 

3.2.      Make a note of the printer's shared name, “sharedprinter”. This will be needed in step 4.5 below.

 

3.3.      Optional – test that the printer prints from the PC. Eg. In the Printer’s Properties panel, select “Print Test Page”.

 

3.4.      Optional – test that the printer is correctly shared on the PC. At the Terminal prompt (Start > Run > Cmd, or command) enter the command:

 

net view \\servername

 

This will list the shared printer and any shared folders.

 

3.5.      Optional – test that the shared printer can be seen over the network from the Mac. First make sure you have enabled Windows File Sharing in the System Preferences Sharing pane.

 

Enter the Terminal command:

 

smbclient –L servername –U username

 

Enter the password for the PC username when prompted. The terminal output will report the list of PC shares including the shared printer. Sometime the command “smbclient –NL servername” will work. Sometimes it is necessary to enter the PC’s IP address instead of the server name when names resolution is an issue.

4. Add the Windows printer in the Mac Print Center.

 

4.1.      Open the Print Center and click "Add Printer" with the Option key held. The Option key may also be labeled Alt. Don’t confuse this with the Command (apple) key, or the Control (ctrl) key.

 

The Print Center takes longer than usual as it gathers additional CUPS printing information. 

 

4.2.      From the main drop down menu select the [Advanced] option. This option is visible at the bottom of the menu. The Advanced options menu will show after a short delay. Further sub-menus will appear depending on the options selected. 

 

4.3.      In the Device drop down, you should see about 8 options.

 

Select: [Windows Printer via SAMBA] and go to Step 4.4.

 

If you do not see the [Windows Printer via SAMBA] option, there may be a problem with Step 1.

 

The following terminal command will verify that the CUPS backend is correctly linked to the Samba windows spooler:

 

ls -l /usr/libexec/cups/backend/smb

 

The response if the link is correctly set up should look like:

 

lrwxr-xr-x 1 root wheel 17 Feb 15 19:41 /usr/libexec/cups/backend/smb -> /usr/bin/smbspool

 

You may try a Repair Permissions or Restart before returning to Step 4.1.

 

4.4.      Give the Device a name. This will be the name that appears in the Print Center list of printers).

 

4.5.      Enter the printer's Device URI in the form:

 

smb://username:password@workgroup/servername/sharedprinter

 

Some have reported to me that for certain Windows setups, the following versions of the URI works depending on security and networking conditions.

 

smb://username@servername/sharedprinter or

 

smb://username:password@servername/sharedprinter

 

smb://username:password@full_domain_name/servername/sharedprinter

 

In the examples above, workgroup is the NetBIOS workgroup name such as ‘mnnet’, or ‘namhm’. Whereas full_domain_name is something like ‘mnnet.net’ or ‘namhm.com’.

 

The following format was used to connect via smb to a Mac OSX 10.2.6 host exporting printers using SAMBA. For the following to work it was necessary to include “guest ok = yes” in the [global] section of the host’s smb.conf file.

 

smb://servername/sharedprinter

 

4.6.      Select the printer type. In the case of Epson COLOR Stylus 740i, I selected ESP (not EPSON).

 

4.7.      Select the printer driver. In the example, “Epson Color Stylus Series CUPS v1.1.”

 

4.8.      Finally, ensure that Windows File Sharing is enabled in the System Preferences Sharing pane.

 

5. Troubleshooting and help.

 

5.1        Print Center status shows that there is a printer connection failure and is waiting 60 seconds to retry.

 

Often you must supply the username and the username password for the PC even if the printer is shared without a password.

 

Try enabling the guest account on the PC. (This idea of enabling guest printing works on a Mac exporting a printer using SAMBA. However, I do not know if enabling the guest account on a PC helps on its own, or whether additional steps are required to allow guest printing).

 

5.2        Print Center shows that printing stalled at 49% or 70% of page 1, and/or you see the transfer on PC start then disappear, but no actual print.

 

Try a different Spool setting in the PC Printer Properties Advanced tab. The option that works best for me is "Start printing after last page is spooled"

 

Note that this problem is different from the generally expected situation where print jobs simply take a very long time to complete.

 

5.3        Try Repair Permissions.

 

5.4        Try rebooting.

 

5.5        Monitor progress in the PC Printer queue window: double-click the printer to show the window.

 

5.6        Monitor progress in the Mac printer queue window: double-click the printer in the Print Center.

 

5.7        Monitor the CUPS daemon messages in the Mac terminal:

 

tail –f –n40 /var/log/cups/error_log

 

This command will continuously display and update the last “n” lines (40 in the example) of the CUPS error log. The log includes informative as well as error messages. Examples of messages posted to the log includes when printers are added (as in Step 3), when there are network connection or authentication problems (as in Step 5.1), and logs each filter step undertaken by the CUPS print daemon.

 

Example of output generated:

 

I [01/Mar/2003:18:41:51 -0600] Setting XP740 device-uri to "smb://whitew:*******@kenwhite/whitew-pc/XP740" (was "".)

I [01/Mar/2003:18:41:51 -0600] Setting XP740 printer-is-accepting-jobs to 1 (was 0.)

I [01/Mar/2003:18:41:51 -0600] Setting XP740 printer-state to 3 (was 5.)

I [01/Mar/2003:18:41:51 -0600] Saving printers.conf...

I [01/Mar/2003:18:41:51 -0600] New printer 'XP740' added by ''.

I [01/Mar/2003:18:42:18 -0600] Job 389 queued on 'XP740' by 'whitew'.

I [01/Mar/2003:18:42:18 -0600] Started filter /usr/libexec/cups/filter/cgpdftoraster (PID 3481) for job 389.

I [01/Mar/2003:18:42:18 -0600] Started filter /usr/libexec/cups/filter/rastertoepson (PID 3482) for job 389.

I [01/Mar/2003:18:42:18 -0600] Started backend /usr/libexec/cups/backend/smb (PID 3483) for job 389.

E [01/Mar/2003:18:43:37 -0600] PID 3483 stopped with status 1!

E [01/Mar/2003:18:43:37 -0600] Error writing file: SUCCESS - 0

E [01/Mar/2003:18:43:37 -0600] SUCCESS - 0 closing remote file Apple _ Discussions _ Apple Bluetooth

I [01/Mar/2003:18:43:48 -0600] Saving printers.conf...

I [01/Mar/2003:18:45:07 -0600] Job 389 was cancelled by 'whitew'.

I [01/Mar/2003:18:45:14 -0600] Saving printers.conf...

 

5.8        Example of smbclient dialogue as used in Step 3.5.

 

[whitew-osx:~] whitew% smbclient -L whitew-pc

added interface ip=192.168.1.102 bcast=192.168.1.255 nmask=255.255.255.0

Got a positive name query response from 192.168.1.105 ( 192.168.1.105 )

Password:

Domain=[KENWHITE] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]

 

        Sharename      Type      Comment

        ---------      ----      -------

        IPC$           IPC       Remote IPC

        print$         Disk      Printer Drivers

        pc-whitew      Disk     

        XP740          Printer   Epson Stylus COLOR 740 ESC/P 2

        ADMIN$         Disk      Remote Admin

        C$             Disk      Default share

 

        Server               Comment

        ---------            -------

 

        Workgroup            Master

        ---------            -------

[whitew-osx:~] whitew%

About this Document

Name – How to Print to Windows from OSX 10.2

Author – William White

Email for comments, feedback and suggestions only – william_white@mac.com

Please post questions concerning Printer Sharing and Windows to the Apple MAC OSX Print Center and Preview discussion forum.

A shortened version of this document is posted in the MAC OSX User-contributed Frequently Asked Questions section.

 

Last updated - 5 January 2004