See, not having lpd as the printing system in OS X was a big bummer to me, because it meant that I could no longer print with my NeXT and other Unix computers, because my printer is now hooked to my G4 Cube (permanently assigned to OS X 10.1). With this little hacked up lpd, I can now do that again. :)
Read the rest of the article for the how-to.
[Editor's note: I have not done this on my machine as of yet, but 'eagle' vouches that it works but only on PostScript printers! Any errors in the following article are a result of my formatting work; please let me know if you see any troublesome lines!]
Here's how to get lpd working:
1] Create the printcap entry. Here's the entry I used:
lp: \The options are:
:sh=true:of=/Users/foo/Applications/lpd-hack: \
:lf=/var/log/lpd-errs:sd=/var/spool/output/lpd:lp=/dev/null:
- sh=true -- suppresses the header page (sh=true is required to print PostScript and PDF files)
- of=.../lpd-hack -- this is the Output Filter that lpr will use. This is what actually prints the file. The of parameter must point to the actual executable script.
- lf=/var/log/lpd-errs -- this was in there by default and I didn't remove it
- sd=/var/spool/output/lpd -- the spool directory; needs to be a valid directory
- lp=/dev/null -- the device where the printer exists; I use /dev/null because I have no printer device!
niload printcap / < /etc/printcap2] Save the following as the script pointed to by the "of=" parameter above
#!/usr/bin/env perlDon't forget to make the script executable.
$temp_file = "/tmp/printing.$$";
# LPD passes via STDIN the file to be printed
# (we don't have any knowledge of the original filename...too bad)
# save this as a file to be processed
@lines = <STDIN>;
open(TMPFILE,">/tmp/printing.$$");
print TMPFILE @lines;
close(TMPFILE);
`/usr/sbin/Print /tmp/printing.$$`;
`/bin/rm -f /tmp/printing.$$`;
3] Start lpd. lpd resides at /usr/libexec/lpd. Simply run "/usr/libexec/lpd" as root from the command line.
4] Restart the queue. Run "lpc" and issue the command "restart all" then exit lpc.
5] Now print. Make sure the $PRINTER environment variable matches the name of the printer in the printcap entry. The default printer is "lp" so if you use the above, you need not set $PRINTER. Print using the command lpr, as in:
lpr file.txtWith this setup, you can print text, PostScript and (!) PDF files. Additionally, you can share a networked printer. Simply add the remote machine's DNS name (haven't tried IP address yet but I would bet that it works) to /etc/hosts.lpd or /etc/hosts.equiv on the OS X box, you can configure /etc/printcap on the remote machine and use lpr/lpd on the remote machine to spool to a printer on the OS X box.
lpr file.ps
lpr file.pdf
Enjoy! Mail me with any questions.

