Skip to content

lpadmin add printer builder

Add a printer from Terminal

Type the printer's IP address and get one lpadmin line for a Mac or Linux computer: the queue, its address, IPP Everywhere or a driver, double-sided and black and white by default, then a test page and the line that takes it off again. It runs in your browser: nothing you type is sent to us.

Copy Room Colour at 10.20.1.22, double-sided black and white on Letter, is an example. Change it to your printer.

Connect over

The printer answers with what it can do and how each job went. Most printers made in recent years take it.

Sides by default
Also

Paste this in Terminal

On a Mac open Terminal from Applications, Utilities; on Linux any terminal. sudo asks for an administrator password.

The commands, 3 lines
sudo lpadmin -p Copy_Room_Colour -E -v ipp://10.20.1.22/ipp/print -m everywhere -D 'Copy Room Colour' -L 'Copy room' -o sides-default=two-sided-long-edge -o print-color-mode-default=monochrome -o media-default=na_letter_8.5x11in -o printer-is-shared=false
lpstat -p Copy_Room_Colour -l
lp -d Copy_Room_Colour /usr/share/cups/data/testprint

The add line, flag by flag

  • -p Copy_Room_ColourNames the queue Copy_Room_Colour: what lp -d and lpstat call it.
  • -ETurns the queue on and lets it take jobs. After -p it means enable; before -p it would mean encryption.
  • -v ipp://10.20.1.22/ipp/printTalks to the printer over IPP on port 631, at its ipp/print queue.
  • -m everywhereAsks the printer what it can do and builds the queue from its answer: no driver to install. The printer has to be on when you run it.
  • -D 'Copy Room Colour'The name people see in the print dialog.
  • -L 'Copy room'Where the printer is, shown beside its name.
  • -o sides-default=two-sided-long-edgeDouble-sided on the long edge unless a job asks otherwise.
  • -o print-color-mode-default=monochromeBlack and white unless a job asks for colour.
  • -o media-default=na_letter_8.5x11inLetter, 8.5 by 11 unless a job names another size.
  • -o printer-is-shared=falseKeeps this computer from offering the printer to others on the network.

If lpadmin answers that it cannot get the printer's attributes, the printer is off, asleep or not on IPP. Check port 631 first, or use port 9100 with a generic driver.

These defaults apply to jobs that do not set their own. A Mac's print dialog may remember the last choice made in it.

ipp is not encrypted on the network. Use ipps if the printer offers it and the network is shared.

After it is added, and to take it off

  • Check it

    lpstat -p Copy_Room_Colour -l

    Shows the queue is there, enabled and ready.

  • Test page

    lp -d Copy_Room_Colour /usr/share/cups/data/testprint

    Prints the CUPS test page, to check it reaches the printer.

  • The undo

    sudo lpadmin -x Copy_Room_Colour

    Removes the queue again. Jobs still waiting in it are cancelled.

The other commands you will want

All of them come with CUPS, the print system on every Mac and most Linux computers. A queue added this way prints over IPP or raw to port 9100; send a job to it with the lp print command builder.

CUPS printer commands and what each does
CommandWhat it does
lpstat -p -dLists every printer queue by name, whether it is enabled, and which one is the default.
lpinfo -mLists the models (drivers) this computer has. The first column is what -m takes.
lpinfo -vLists the connections CUPS can see, including printers it finds on the network.
lpoptions -p NAME -lLists the options a queue takes, with its current choice marked by a star.
sudo lpadmin -d NAMEMakes a queue the default printer.
sudo lpadmin -x NAMERemoves a queue. Jobs still waiting in it are cancelled.

Driver or no driver?

Driverless printing is the first choice: CUPS marks printer drivers as deprecated. Use a print driver only for a printer that does not speak IPP.

  • -m everywhere

    Asks the printer over IPP for its paper sizes, sides, colour and finishing. The printer must be on when lpadmin runs.

  • Generic PCL or PostScript

    For port 9100. It prints plain jobs, without the model's trays, staples or hole punch.

  • The model's own

    Install the maker's package, then find its line in lpinfo -m and paste the first column.

  • Not sure it answers?

    Check ports 631 and 9100 first with the printer port checker.

One printer list, for every Mac and Chromebook.

This line adds one printer to one computer. In KyberCopy the copy room adds each printer once, the relay reads what it can do over IPP, and teachers send from the request form on any device without a queue to set up.

Book a demo