In Mac OS X, how do I use the Unix command-line print commands to print to a PostScript printer?
To print to a PostScript printer from the Mac OS X Unix prompt, use the lpr command. To set it up, you need to meet the following requirements:
- The following instructions assume you know your way around
Unix. You must know how to access the Unix prompt with the Terminal in
Mac OS X, and what to do when you get there.
- You must have root access to your computer. It is not necessary
to have the root user enabled, but you must know the root password.
- The printer to which you wish to print must provide LPR printing over TCP/IP. You must know its IP address or domain name.
To set up your printer, you'll need to do the following:
- Access the Mac OS X Unix prompt. You may do this with the
Terminal application, which is in
/Application/Utilities.
- Become the root user. You can do this by entering at the prompt:
su
When prompted, enter the root password.
- Create a printcap entry for your printer. You may do this by
editing
/etc/printcap, or you may create a personalprintcapfile in your own account. For the rest of these instructions we'll assume you're doing the former. In the printcap file, create an entry for your computer. For a printer named vader, with an address ofvader.empire.gov, the entry would look like this: vader:\ :lp=:rm=vader.empire.gov:rp=lp:sd=/var/spool/lpd/vader:\ lf=/var/log/vader-errs: The rest of these instructions will use this printer as an example. Substitute the name of your printer forvaderwherever it appears.
- Create the spool directory for your printer. To do this, enter: mkdir -p /var/spool/lpd/vader
- Create the sequence number file in the printer's spool directory. To do this, enter: touch /var/spool/lpd/vader/.seq
- Create the error log file for the printer: touch /var/log/vader-errs
- Set the owner and group to root and daemon, respectively, for the spool directory, the sequence number file, and the error log file. Enter: chown -R root.daemon /var/spool/lpd/vader /var/log/vader-errs
- Set the permissions on the error log file to world readable. Enter: chmod 644 /var/log/vader-errs
- Load your printcap entry into NetInfo. Enter: niload printcap / < /etc/printcap
- Launch the Print Center (in
/Applications/Utilities).
- Click the
Add Printer...button.
- In the sheet that appears, select
Directory Servicesfrom the pop-up menu.
- Click your printer's name, then click
Add.
You may then use the lpr command to print to your printer. To print
the PostScript document thesis.ps to the printer vader,
you would enter:
lpr -Pvader thesis.ps
Also see:
- In Pine, how do I print messages?
- How do I convert between Unix and Mac OS or Mac OS X text files?
- For Mac OS X, what are some useful utilities for troubleshooting and optimizing performance?
This is document aklx in domain all.
Last modified on December 21, 2004.
Last modified on December 21, 2004.
Please tell us, did you find the answer to your question?






