How to Use the macOS lpadmin Command to Manage Printers in the Terminal

The Hidden CUPS Printing Engine

In macOS, if you need to add a new network printer, change the default paper size, or delete an old printer, the standard approach is to open the System Settings app and navigate to the “Printers & Scanners” menu. This graphical interface is perfectly fine for a home user managing a single inkjet printer.

However, if you are a system administrator who needs to instantly deploy a fleet of 50 identical laser printers to an entire department of MacBooks, clicking through graphical menus 50 times is incredibly inefficient.

Beneath the graphical interface of macOS runs the Common UNIX Printing System (CUPS). Because CUPS is an open-source Unix standard, you can bypass the graphical menus entirely and configure your printers directly from the command line using the highly powerful lpadmin command.

Step 1: Open the Terminal

Because you are modifying system-level hardware configurations, you must run all lpadmin commands with root privileges.

  1. Press Command + Space to open Spotlight Search, type Terminal, and press Enter.
  2. Prefix your commands with sudo.

Step 2: Adding a New Network Printer

To add a brand-new printer using a script, you must provide lpadmin with a custom name, the network IP address, and a PPD (PostScript Printer Description) driver file.

sudo lpadmin -p "Finance_LaserJet" -E -v lpd://192.168.1.150 -P /Library/Printers/PPDs/Contents/Resources/HP_LaserJet.ppd

Breaking down the command:

  • -p (Printer Name): The custom, human-readable name you want to assign to the printer (e.g., Finance_LaserJet). No spaces allowed.
  • -E (Enable): This crucial flag tells macOS to instantly enable the printer and start accepting print jobs immediately.
  • -v (Device URI): The network path to the printer. This usually requires the protocol (like lpd:// or ipp://) followed by the IP address.
  • -P (PPD File): The absolute path to the driver file required to translate the documents into a format the printer understands.

Step 3: Setting the Default Printer

If an employee’s MacBook is connected to five different printers, they will inevitably send their print jobs to the wrong one unless a default is set.

You can force a specific printer to become the system-wide default by using the -d (default) flag.

sudo lpadmin -d "Finance_LaserJet"

Now, whenever the user presses Command+P in any application, the Finance LaserJet will be automatically selected in the drop-down menu.

Step 4: Configuring Printer Options (Paper Size and Duplex)

Some printers default to European A4 paper instead of standard US Letter (8.5 x 11), causing documents to print improperly. You can use the -o (options) flag to hardcode default settings into the printer profile.

To force the printer to use US Letter paper:

sudo lpadmin -p "Finance_LaserJet" -o PageSize=Letter

To force the printer to print double-sided (duplex) by default, saving paper across the entire office:

sudo lpadmin -p "Finance_LaserJet" -o sides=two-sided-long-edge

Step 5: Deleting an Old Printer

When an old printer breaks and is physically removed from the office, you should remove it from the employees’ MacBooks to prevent them from endlessly sending documents to a machine that no longer exists.

To completely delete a printer from the CUPS system, use the -x flag followed by the exact printer name.

sudo lpadmin -x "Old_Broken_Inkjet"

The printer will instantly vanish from the macOS System Settings menu.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.