Creating Mac Printing Packages – lpadmin

This is for when you have a print queue and unmanaged macs that you need to create a bundle printer install for. I’ll add the rest of this post later – basically use casper composer or iceberg and add the printer profiles, drivers and icons.

then you’ll need to add a post install script… use this one, but adjust as needed:


## postinstall

## Add as many printers as you need to bundle with this command
lpadmin -E -p Printer_Name_No_Spaces_Allowed -v smb://PrintServer/PrintQueue -P “/Library/Printers/PPDs/Contents/Resources/Printer Model.gz” -L “Location” -o printer-is-shared=false -E

## CUPS needs to be restarted to wake up the printer
/usr/sbin/cupsenable $(lpstat -p | grep -w “printer” | awk ‘{print$2}’)
exit 0 ## Success
exit 1 ## Failure

*** I know this isn’t great code but if you need to get things started this will set you off – as always use at your own risk. Also, as with most of my knowledge this is based off mixing together better peoples ideas – check Tremily and thanks to Walter Meyer for just being awesome and putting this stuff up online. ***

Additions From Rick Goody

So you are missing some parts.

lpadmin -D “User Friendly Name – All Characters allowed”

If you are using SMB printers you should also run

defaults write /Library/Preferences/ UseShortName -bool YES

Otherwise auth won’t work as smb wants the user short name or SAMid details not full name as apple will try and use

CUPS does not need to be restarted. thats what the -E does

Also another little trick to deploy printer presets to create presets, and deploy to all current users and user template folder. The Preference file is stored “~/Library/Preferences/” as per your script as the -p option

Also in mavericks if you are going to deploy or modify presents on the fly you need to run command from terminal “KillAll cfprefsd” before modifying prefs or use defaults write command

also another little tip. if you want to remove a printer

lpadmin -x Printer_Name_No_Spaces_Allowed


Please be aware that printer packages from Mavericks- Yosemite – El Capitan are like a yoyo with requirements so check your setup and google, this code is only here for historical reference.

Leave a Reply