CUPS + AirPrint on Raspberry PI

Install CUPS and Enable Remote Access

apt-get install cups


Add Pi user to lpadmin group

usermod -aG lpadmin pi


Enable Remote Access


Comment out Listen localhost:631 and add Port 631

then Allow access



# Only listen for connections from the local machine
# Listen localhost:631
Port 631


< Location / >
# Restrict access to the server...
Order allow,deny
Allow @local
< /Location >

< Location /admin >
# Restrict access to the admin pages...
Order allow,deny
Allow @local
< /Location >

< Location /admin/conf >
AuthType Default
Require user @SYSTEM

# Restrict access to the configuration files...
Order allow,deny
Allow @local
< /Location >


Restart CUPS

/etc/init.d/cups restart


Now you are able to access remotely x.x.x.x:631 and add the printer


Install AirPrint

apt-get install avahi-discover cups cups-pdf python-cups

apt-get install hplip


Make your old printer AirPrint capable

/etc/init.d/avahi-daemon start mkdir /opt/airprint cd /opt/airprint wget -O --no-check-certificate chmod +x ./ -d /etc/avahi/services /etc/init.d/avahi-daemon restart ls /etc/avahi/services/

Add those files with this content


image/urf application/vnd.cups-postscript 66 pdftops



image/urf urf (0,UNIRAST)



image/urf application/pdf 100 pdftoraster


Open port 631

iptables -A INPUT -i eth0 -p tcp -m tcp –dport 631 -j ACCEPT

iptables -A INPUT -i eth0 -p udp -m udp –dport 631 -j ACCEPT


Disable power saving (optional)

# Disable power saving options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

Connect from windows




13 Comments so far:

  1. Congratulations.
    I was searching about 3 weeks for a solution with my canon-ts5050 printer. I have contacted canon and they returned their printer are only working in win and mac. But your way was right to print in raspbian. I am happy. Thank you.

    • glad to help,.. it was all about my 25 years old HP laser jet,.. it works much better then printers you can buy these days,..

  2. So I was able to follow it halfway… I came to the section the files in the /mime/ folder, but I am not able to find any of those files. Do I need to create those files?

  3. so far this was the only method that made my airprint to work with raspberry but many times doesnt show to print or takes some time to find the printer. Any idea what could be the issue?

  4. It is some network conflict most likely. Never google for it, so I have no proof, but it seems to me that some routers has problem with air print protocol. I had similar situation where I needed to reconnect to wifi in order to see printer. Then I changed my internet provider, got new router, and never have that issue again.

  5. Tried this procedure with a pi 1B, Stretch and an HP LaserJet 5 connected with parallel to USB adapter. Used the Gutenprint cups driver. Can print from the pi and a Win 10 laptop. Airprint however gives a “filter Failed” error message in cups. double checked everything even rebooted but no luck. Anyone have any ideas

  6. Hi, for my Debian system, this process worked to finally share my Samsung CLX6220fx colour laser as an airprint device without having to have a Mac. Thanks! (And I didn’t need to create the files, not on a Pi system.)

  7. Hi, Tried a few procedures to get airprint working on my pi without success. Finaly tried yours and all is good.

    Thanks so much!

  8. This is great! I used these instructions on my Ubuntu 18.04 Server w/existing CUPS installation to allow my iPhone and iPad to print! That python script is clutch!

  9. Brilliant! Been trying to get IOS devices to print for a week – your methods work on my openmediavault server (Debian base). Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Posted by: lesorsier on

Tags: ,