ARCHIVED: In Mac OS X, how do I use Unix commands to print to a PostScript printer?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

To print to a PostScript printer from the Mac OS X Unix prompt, use the lpr command.

Note: For these instructions, you must have root access to your computer. You don't need the root user enabled, but you must know the root password. Also, your printer must support LPR printing over TCP/IP, and you must know its domain name or IP address.

To set up your printer (substitute vader.empire.gov with your printer's domain name or IP address):

  1. Become the root user. At the prompt, enter:
      su

    When prompted, enter the root password.

  2. Create a personal printcap file in your own account, and include an entry for your computer:
      vader:\
              :lp=:rm=vader.empire.gov:rp=lp:sd=/var/spool/lpd/vader:\
              lf=/var/log/vader-errs:
  3. At the Unix prompt, create the spool directory for your printer:
      mkdir -p /var/spool/lpd/vader
  4. Create the sequence number file in the printer's spool directory:
      touch /var/spool/lpd/vader/.seq
  5. Create the error log file for the printer:
      touch /var/log/vader-errs
  6. Set the owner and group to root and daemon, respectively, for the spool directory, the sequence number file, and the error log file:
      chown -R root.daemon /var/spool/lpd/vader /var/log/vader-errs
  7. Set the permissions on the error log file to world readable:
      chmod 644 /var/log/vader-errs
  8. Load your printcap entry into NetInfo:
      niload printcap / < /etc/printcap
  9. Launch the Print Center (in /Applications/Utilities).
  10. Click Add Printer....
  11. In the sheet that appears, select Directory Services from the pop-up menu.
  12. Click your printer's name, and then click Add.

To print the PostScript document thesis.ps from the command line, enter:

  lpr -Pvader thesis.ps

This is document aklx in the Knowledge Base.
Last modified on 2018-01-18 13:02:23.