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=:rm=<printer ip or name>:rp=lp:\
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:
I should note that this hint is originally from the TeXshop readme.

Have fun,
  • Currently 2.20 / 5
  You rated: 4 / 5 (5 votes cast)

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 installation.

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

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 (if you get my drift), so I had to specify

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


[ Reply to This | # ]