How To Deploy AirPrint Printers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 02-24-2025 12:33 PM
I recently spent some time working on a script to deploy AirPrint printers as we’ve got a few of them on our campus that don’t have driver support from the manufacturer, meaning AirPrint is the only option. I wanted to share what I’ve come up with in case anyone else is in need of this.
All you have to do is change the details in the “Printer details” section at the top of the script to match your printer’s IP address, location, and display name. I’d also recommend modifying the PPD path slightly to give it a more specific name than just printer_driver.ppd. Example: break_room_printer_driver.ppd.
Note: For this to work, the Mac needs to be on the same network as the printer since it queries the printer to gather the information to create the PPD file.
The result is that you can deploy an AirPrint printer to your Macs via Jamf Pro complete with the icon and everything!
#!/bin/bash
# Adds a printer via AirPrint.
# Author: John William Sherrod - jwsherrod@mac.com
# Version 1.0: 02-20-2025
# Printer details
PRINTER_IP="111.11.11.11"
PRINTER_NAME="Printer_Name" # Name that will appear in the printer list
PRINTER_LOCATION="Printer Location" # Location description
PRINTER_DISPLAY_NAME="Printer Display Name" # Friendly display name
PPD_PATH="/private/tmp/printer_driver.ppd" # Location of PPD
# Create PPD using ipp2ppd with error handling
echo "Generating PPD file for printer at $PRINTER_IP..."
if ! /System/Library/Printers/Libraries/ipp2ppd "ipp://$PRINTER_IP/ipp/print" "" > "$PPD_PATH" 2> /tmp/ipp2ppd_error.log; then
echo "Error: Failed to generate PPD file. Check printer IP or IPP service availability."
if [ -s /tmp/ipp2ppd_error.log ]; then
echo "Details: $(cat /tmp/ipp2ppd_error.log)"
fi
rm -f /tmp/ipp2ppd_error.log # Clean up error log
exit 1
fi
# Check if the PPD file exists on the system
if [ ! -f "$PPD_PATH" ]; then
echo "Please deploy the PPD file first. Exiting."
exit 1
fi
# Check if printer already exists
if lpstat -p | grep -q "$PRINTER_NAME"; then
echo "Printer '$PRINTER_NAME' already exists. Skipping installation."
exit 0
fi
# Add the printer using lpadmin
# -P specifies the PPD to provide the printer's icon, deployed from Jamf Pro via a package
# -v specifies the device URI using the IP address
# -E enables the printer and accepts jobs
/usr/sbin/lpadmin -p "$PRINTER_NAME" \
-L "$PRINTER_LOCATION" \
-D "$PRINTER_DISPLAY_NAME" \
-v "ipp://$PRINTER_IP/ipp/print" \
-P "$PPD_PATH" \
-E \
-o printer-is-shared=false
# Verify installation
if [ $? -eq 0 ]; then
echo "Successfully added printer '$PRINTER_NAME' at IP $PRINTER_IP"
# Set as default printer (optional - comment out if not needed)
# /usr/sbin/lpadmin -d "$PRINTER_NAME"
else
echo "Failed to add printer '$PRINTER_NAME'"
exit 1
fi
exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 02-24-2025 08:04 PM
@john_sherrod Thank you for sharing,
The script is very useful for the future,
can you add a list of printers that you have tested?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 02-25-2025 07:24 AM
Here are the three we have that we’ve successfully used this script with:
Brother MFC-L9670CDN
Brother HL-L2360D
Brother HL-L5100DN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Thank you very much for sharing your solution. I work at a special needs school without about 110 staff MacBooks and have been attempting to create a script to deploy our AirPrint printers. I am logged in as root on my MacBook and testing the ipp2ppd command with some of our AirPrint printers, before I create the script in Jamf. However, it never returns, and the ppd and log files remain zero length. Do you have any suggestions for why ipp2ppd might not exit? Here is what I entered for one of our AirPrint printers:
/System/Library/Printers/Libraries/ipp2ppd ipp://10.10.1.4/ipp/print "" > /private/tmp/printer_driver1.ppd
Thank you for taking the time to read my question.
- Peter Dearstyne
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Is it possible that your Mac and the printer aren’t on the same network or are perhaps on different VLANS? It would definitely fail if that were the case.
