2007-05-22

The joy of CUPS

Filed under: Geekiness — iain @ 19:43:32

I bought a printer. All companies need a printer. Being able to print is an essential part of doing business. Now that I run a company, I needed one.

The printer, an HP Photosmart 4180, connects to a computer by USB cable. I connected it to my MacBook Pro since I expected that I would mostly need to print from Mac applications. Soon enough, however, I needed to be able to print an invoice for an online purchase I’d made using a web browser on my Linux machine. Which meant that I needed to be able to make the printer available across the network.

If you aren’t a technical person yourself, think for a second how often people at your office need to call the IT desk to sort out a problem with printers. Consider how often they go wrong. Think about the hassle involved in setting them up.

Now consider that the last time I set up a printer, you had to do it by opening – in a text editor – files like this:

lp|local printer|HP DeskJet 690C:\
:lp=/dev/lpa0:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errs:\
:sh:pl#66:pw#80:if=/usr/local/libexec/lpfilter:

ps|Ghostscript driver:\
:lp=/dev/lpa0:sd=/var/spool/lpd/ps:lf=/var/log/lpd-errs:\
:mx#0:sh:if=/usr/local/libexec/lpfilter-ps:

That isn’t random gobbledegook; that’s a printcap file, and you were expected to write it by hand. Unless, that is, you used Red Hat Linux, which boasted a menu-driven text application which attempted to write it for you, and which was hailed as the best thing since sliced bread by Linux aficianados.

Now I happen to know that Mac OS X uses CUPS, the Common UNIX Printing System. It’s a software suite designed to make printing somewhat less of a black art.

I installed CUPS on my Linux machine. Then I followed these steps:

  1. I clicked "Share these printers" in the printer control panel on my Mac.
  2. I started cupsd on the Linux box.

Then I clicked the Print button in my web browser … and a full-colour rendition of the page whirred its way out of the printer.

The printer didn’t explode in a violent ball of flame. It didn’t print random characters, twenty to a page, until it ran out of paper. There were no error messages or complaints from the Linux machine or the Mac. It Just Worked.

I can’t imagine many readers will be overly impressed by this. But by my stars, I was.

2 Comments »

  1. How did the cups on the Linux box know that it was supposed to use the printer connected to the Mac? I’ve used a similar trick recently but I had at least to add the printer on the Linux box.

    Comment by Tron — 2007-05-25 @ 14:13:21

  2. Magic I guess.

    Comment by iain — 2007-05-31 @ 20:16:46

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress