Install Printers on macOS from Terminal

Having recently been asked to install printers to a bunch of macOS users remotely, this got me thinking; How can this be automated via shell script?

A simple script should be easy enough to create a printer, link a driver and assign the IP address. The same script should then be able to be manipulated to remove it if required.

So heres the script:

sudo /usr/sbin/lpadmin -p “printer name” -E -v lpd://”printer IP/hostname”/”queue name” -P “path to PPD file” -D “printer description”


sudo /usr/sbin/lpadmin -p FMPMAC -E -v lpd://””/”FMPMAC” -P /Library/Printers/PPDs/Contents/Resources/FX\ ApeosPort-IV\ C4475\ PS.gz -D FMPMAC -o printer-is-shared=false

The above script will only work if you have the printer drivers already installed. In my organisation we’re using LANDesk Management Suite, which can push out and install the drivers ahead of time, or when provisioning devices.

In the case where you need to copy the files manually, This is also done via a script:

sudo cp -R /Volumes/FMPMAC/FX\ ApeosPort-IV\ C4475\ PS.gz /Library/Printers/PPDs/Contents/Resources\

In the instance that you need to remove the printer, simply change the first -p with a -x

You can find the printer configurations in a web browser using the CUPS web-interface, to enable this run the following command in terminal:

cupsctl WebInterface=yes

Then open a web browser and navigate to http://localhost:631/printers/ click on the printer’s name and you can then see the URL and driver information.




-p : configures printer

-E : enables printer to accept print jobs

-v : Assigns printer URL

-P : specifies a ppd file to use

-D : creates a text description for the printer


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s