Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Printing from a terminal session (lpr) UNIX
A while ago someone asked about how to configure osx for printing from the command line.

If you have a postscript printer in your network, this is actually pretty simple. Create a printcap file (named "myprintcap" for example) with jEdit, or vi or emacs or any other text editor:
lp:\
:lp=:rm=<printer ip or name>:rp=lp:\
:sd=/var/spool/lpd/lp:ty=PostScript:
Save this file somehere in your directory. Note: there should be backslashes terminating the first two lines. They were consumed by the scripts processing this hint, I guess. [Editor's note: Backslashes get stripped out, unless you enter in HTML mode, and use the character code '&#092;' for a backslash ... I've added them to the above lines.

Next you load this printcap into netinfo (line 1 below) and create the spool directory (line 2). Open a terminal and connect as root ("su"), then type:
niload printcap / < path/to/myprintcap
mkdir /var/spool/lpd/lp
Now you can print ps files from the command line by typing:
lpr file.ps
I should note that this hint is originally from the TeXshop readme.

Have fun,
Sven
    •    
  • Currently 2.20 / 5
  You rated: 3 / 5 (5 votes cast)
 
[21,966 views]  

Printing from a terminal session (lpr) | 2 comments | Create New Account
Click here to return to the 'Printing from a terminal session (lpr)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
More on printing from a terminal session
Authored by: jmiller on Sep 21, '01 07:52:24PM

Two semi-newbie questions about the previous post regarding printing from a terminal session:

(1) I followed the instructions, and "lpr foo.txt" is indeed getting files into the spool directory I specified. But they're not getting to the printer, presumably since I'm not running an lpd daemon (which the original post didn't say anything about). Or are the other OS X printing services supposed to handle this? Is there a missing step? I'm running a pretty clean 10.0.0.4 installation.

(2) If this scheme can be made to work, will it work with AppleTalk-connected printers, or only TCP/IP printers?

Thanks,
Jim Miller



[ Reply to This | # ]
More on printing from a terminal session
Authored by: eijkhout on Feb 09, '02 08:01:23AM

Sven wrote a termcap entry that contained:
:lp=:rm=<printer ip or name>:

In my case that didn't work: my printer was named
abc@my.net (if you get my drift), so I had to specify
:lp=abc:rm=my.net:

Other than that I can now print with lpr. Hey.....

Victor.



[ Reply to This | # ]