Published

Using a Raspberry Pi as a cheap AirTunes server

I hate giving Apple more money than I have to. Sure, I own a MacBook Air and it’s wonderful, but I chafe at Apple charging me $99 for an AirPort Express just to stream music wirelessly to my stereo. I don’t need another Wi-Fi base station, anyway. So I decided to build my own AirTunes server with a Raspberry Pi. Here’s how to do it really easily.

Assuming you already have a Pi, you’ll need to install a Linux distribution on an SD card and boot the Pi from that. The quick start guide will walk you through this; you can use NOOBS to install the recommend distribution (Raspbian) or just use the Raspbian image directly.

The first time you use Raspbian, you’ll need to connect a monitor and keyboard to the Raspberry Pi so that you can configure it using raspi-config. But I recommend that you turn on the SSH server so that you can log into the Pi remotely the next time. You’ll find that option under Advanced > SSH (option 4). Also, make sure you “expand rootfs” to grow the root disk to the size of your SD card, otherwise you’ll run out of room.

The software that emulates an AirPort is called Shairport. I’ve built a .deb so that you don’t have to go install a C compiler, development libraries, etc. on your Pi and clutter it up. You can find that here:

Copy this to your Pi using scp and run sudo dpkg -i shairport_1.0.0-1_armhf.deb. It will start Shairport automatically, as well as avahi-daemon for your mDNS (multicast DNS) listener, which is what AirTunes uses for autodiscovery.

Now, you should be able to go to iTunes on your Mac and see the AirPlay icon in the main status bar. It looks like a rectangle with an upward-pointing triangle at the bottom. Click on it, select the Pi, and start streaming music to it!

If you find any errors in my packaging scripts, please send me a pull request on GitHub.