So, this weekend, I ran in the Spartan Sprint, the event I and a few friends were training for over the past month or so. The Spartan sprint is a 5KM long obstacle course, which was tiring, but very very fun.

I had my Go Pro strapped to my chest and got some great footage, which I edited together into a little video (which I’m quite please with, especially as it was a first attempt put together in a hurry).

I am aware this post digresses from my usual technology focus, but watch the video and I’ll bring it back to the point in a minute.

Right.

I put this together with Apple iMovie on the Mac Mini I bought so I could do some iOS development. Previous attempts at editing video using FOSS tools had been painful, but iMovie was a total dream to use – simple and intuitive interface, I could add and edit the soundtrack, there was a bunch of handy effects. Obviously, it’s not a professional edit suite, but it was more than enough for me to hack together a little demo video on an evening.

However, I’m pretty pissed off. For two reasons.

Firstly, FOSS… pull your finger out! Video editing on Linux is absolutely horrific… sort it out.

Secondly, Apple have made the wonderfully intuitive and simple application that works really well. So what the hell is the excuse for iTunes?

You have none, Apple.

The UX is ropey and inconsistent, it is bloated and needs to be updated every ten minutes, and my biggest gripe; if you have your music library on a network drive and forget to mount it before starting iTunes, it’ll forget it entirely and then force you to factory reset your phone before it’ll let you do any updates.

I know this is down to the DRM Apple was forced to build to get music industry buy-in on the iPod concept, but it’s 2013 and if DRM went away tomorrow, the music industry would not pull everything out of the iTunes store. So, why are you making my life suck Apple? Why did I have to buy a new MP3 player just so I could update my playlist and avoid having to run iTunes?

You make some great stuff Apple, so why does iTunes suck so hard?

Apple Airprint is a technology (a zeroconf implementation under the bonnet) which allows apple devices to detect, configure and print without any overt configuration on the part of the user.

The bad news is that in only works for a handful of airprint printers natively. But never fear, Linux to the rescue!

At this point I’m going to assume that you have a Linux box somewhere on your network acting as a file and print server (pretty regular kit in most geek homes).

Set up your printer

The first step is to set up CUPS on your linux server and then installing the appropriate printer driver for your printer.

I won’t go into detail here as there are numerous guides out there on the wider web, but mostly this is a matter of installing cups and foomatic and then visiting the cups configuration website on the server (localhost:631 usually) and adding your printer.

Make sure that the printer is shared. Print a test page.

One gotcha I found is that my default configuration only allowed connections from the local machine, even though the printer was marked as shared (although frankly I was cheating since most of my computers printed to my server over a Samba relay, but that’s by the by).

Take a look at /etc/cups/cupsd.conf and make sure that has an Allow From from your local network. E.g.


<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.0.0/24
</Location>

Export the printer

The next step is to install the zeroconf demon, which is called Avahi. This varies from system to system, but on debian this is pretty much a matter of apt-getting avahi-daemon. You may also want avahi-discover so you can browse the exported devices on your network.

Assuming you’ve correctly set up and shared your printers in CUPS the next step is to generate an avahi configuration for it. Thankfully, there’s a handy Python script called airprint-generate, available on github which does much of the donkey work.

Copy the resultant file to /etc/avahi/services and restart the avahi demon.

If your printer is password protected, you will want to add a <txt-record>air=username,password</txt-record> field to the file before doing so. Where username and password is the literal cleartext strings sent.

Profit!!!

Theoretically that should be it. After the configuration, and restarting the various demons involved your printer should be available to the various iOS devices kicking around your network.

Let me know if you have any questions!

Update for IOS6 users

If you are using IOS6 and are seeing a “no airprint printers found” when you try and print (even when ios5 devices can print fine), you must make a small configuration change to CUPS.

Create two extra files in /usr/share/cups/mime:

airprint.types

image/urf urf string(0,UNIRAST<00>)

airprint.convs

image/urf application/pdf 100 pdftoraster

Then restart CUPS before regenerating the avahi configuration file for your printer using airprint-generate as documented in the steps above. Replace your existing avahi printer configuration with this new one and restart avahi.

You printer should now be visible again to both ios5 and ios6 devices via airprint.