AirPlay – With Shairport on my RaspberryPi

In today’s posting I want to share my experience setting up Shairport on my RaspberryPi. As I am by far not the first one describing this process I want to focus on the one step that didn’t work out immediately (missing Perl module). If you are not familiar with AirPlay have a look at Apples official site (Airplay @ Apple Site) or have a look at the Wikipedia site (Airplay @ Wikipedia. This tutorial is again based on Debian Wheezy (2012-10-28-wheezy-raspbian.img from the official RaspberryPi website)

First, set the audio output to the 3.5mm audio jack that comes with your RaspberryPi. If you own an USB sound device feel free to use that.

amixer cset numid=3 1

Change the last digit to 2 for HDMI or 0 for automatic.

Shairport has a few dependencies you have to resolve before you can install it.
Use the following command to install them:

apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils

After that, clone the Shairport git repository to you local disk

git clone https://github.com/albertz/shairport.git shairport

Change to the newly created directory and start the make process

make; make install

Afterwards execute the newly created Perl script

./shairport.pl

After a few seconds you might see a Perl error similar to “Can not find NET::SDP.pm”. If that happens open cpan.
If this is the first time – after a fresh installation – you enter cpan it will probably start to update itself to the latest version.
After the update process has finished, reload cpan and install NET::SDP by entering:

install NET::SDP

If you want to start Shairport automatically after booting your RaspberryPi – feel free to use the init script located in the Shairport directory.

3 thoughts on “AirPlay – With Shairport on my RaspberryPi

  1. Will

    Hi thanks for the tutorial! I was just wondering though, how do you set a USB sound card as the default playback device? Is there a certain id like the hdmi id 2?

    Also I tried to install NET:SDP but I get a warning cannot install NET:SDP, don’t know what it is.

    If you have any idea of what to do that would be great. Thank you for your time.

    1. Josef Post author

      Hi

      Since I did not test it with HDMI “speakers” I don’t know the right ID. Would it try with 2 I guess ;)

      How did you try to install it?
      apt-get?

      regards

Comments are closed.