AirPrint for Mac on Linux

Apple is finally offering printing services from your iOS device, they are marketing this capability as AirPrint and it is in fact an amalgam of a number of existing network technologies. There are some HP printers already configured for AirPrint, but the list is rather short. Wouldn’t it be nice if you could use your existing printers to do this?

Thanks to Ryan Finnie for his research and TJ Fontaine for a fabulous script that automates the services configuration for your AirPrint printers.

Before proceeding, this tutorial assumes you are running CUPS on a Linux (Ubuntu) server to share out one or more printers on your network. In my configuration, an HP PSC 500 provides printing and scanning services and a Brother 2820 is our general purpose laser printer with fax. After settings things up for AirPrint using CUPS and Avahi, I am now able to print successfully to both devices from my iPhone 3GS.

  1. Configure CUPS. Get your CUPS server properly configured. This is going to require the following entries included in your cupsd.conf:
    Listen 631
    Browsing on
    BrowseOrder allow,deny
    BrowseAllow all
    BrowseLocalProtocols CUPS dnssd
    BrowseAddress @LOCAL
    ServerAlias *
    It will need to be have the option to share printers connected to the system (Browsing On), as a general rule of thumb if you can print to your CUPS server from another computer on your network then it’s probably configured correctly.
  2. Install Avahi. You need this to broadcast your printer services, if you’re running Ubuntu server this can be done as follows:
    sudo apt-get install avahi-daemon
  3. Download TJ’s Script. It will make your next step much easier:
  4. Run the airprint-generate script. This produces services files for Avahi. Copy the resulting files to:
  5. Restart Services. Restart your avahi service:
    /etc/init.d/avahi-daemon restart

Now browse to your printers on your favorite iOS device running 4.2.1 or later, when selecting Print from any of the standard applications (Mail, Safari, etc.) your printers should appear available.

AirPrint from iPhone to HP PSC 500

If you made it this far and are on iOS 6, then your journey is not yet complete. Visit AirPrint on Linux with iOS 6 for a rundown on how to get your server setup to support the changes Apple made in this release.