Indiana University
University Information Technology Services
  
What are archived documents?

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:

  1. Access the Mac OS X Unix prompt. You may do this with the Terminal application, which is in /Application/Utilities.

  2. Become the root user. You can do this by entering at the prompt: su When prompted, enter the root password.

  3. Create a printcap entry for your printer. You may do this by editing /etc/printcap, or you may create a personal printcap file 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 of vader.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 for vader wherever it appears.

  4. Create the spool directory for your printer. To do this, enter: mkdir -p /var/spool/lpd/vader
  5. Create the sequence number file in the printer's spool directory. To do this, enter: touch /var/spool/lpd/vader/.seq
  6. Create the error log file for the printer: touch /var/log/vader-errs
  7. 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
  8. Set the permissions on the error log file to world readable. Enter: chmod 644 /var/log/vader-errs
  9. Load your printcap entry into NetInfo. Enter: niload printcap / < /etc/printcap
  10. Launch the Print Center (in /Applications/Utilities).

  11. Click the Add Printer... button.

  12. In the sheet that appears, select Directory Services from the pop-up menu.

  13. 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:

This is document aklx in domain all.
Last modified on December 21, 2004.
Please tell us, did you find the answer to your question?