How to get Apple Music on Sonos


Update: With iOS 9 and El Capitan Apple made some pretty major changes to AirPlay which of course break hacks like this. Here's the fix but I'm hoping they fix AirSonos in the future because no one likes running vim to make changes. I use nano instead just because it upsets people. ;)

Yesterday was the initial launch of Apple Music and I've got say its been pretty interesting to use. I think it fits in somewhere between Spotify and Pandora and I'm curious how well the live radio portion is going to work. So far I actually like listening to the DJs since, unlike your local radio DJ, their interaction is pretty minimal. So far, so good but one thing I am clearly missing is a way to get the music over to the best speakers I have in the house: two Sonos Play3s I purchased a few years back.

Sonos announced that Apple Music would be available by the end of the year with no clear timeline -- but what if you can't wait that long? 

AirPlay without the Extra equipment

Even though many (including myself) have been complaining for years about Sonos not supporting AirPlay secretly I can actually understand why they haven't done it. The way in which Sonos works is so much different from how traditional AV systems work -- which is what AirPlay integrates well with. AirPlay acts more like the traditional line-in on your Sonos. In fact, using an AirPort Express with an audio cable is how Sonos officially recommends you integrate AirPlay with their systems. 

I don't think this is what Sonos wants to be their customer's experience and I know it isn't what I want but there's nothing Sonos (or I) can do until Apple opens up their products a little more -- which may never happen. AirPlay is, unfortunately, what we are stuck with. 

Time To Hack :)

About a year ago I ran across a small project that allowed me to run a simple program on my computer that would find all of my Sonos players and broadcast them as AirPlay endpoints. Here's how to get it up and going. I'm going to use Mac commands below but Windows commands should be similar.

Step 1: Install Node.js

This is pretty easy. Just head over to and download one of their installers. 

Step 2: Install AirSonos with NPM

Node.js comes with a really cool package manager that allows you to install programs or other Node.js packages needed for development. Since we really aren't developing anything it isn't that useful for us now but it does a nice job of going out and finding all of the other required programs needed to get this working and installing them. Just open up a terminal window or command line and type in the following:

$ npm install airsonos -g

This will install everything you need and give you a command line to use. Just type airsonos and hit enter. Everything should just work. Magic.

$ airsonos
Searching for Sonos devices on network...
Setting up AirSonos for Dining Room {}

Step 3: Play Some Music

Now it's time to open up the new Music app -- or any other app and play some music. As long as you leave the terminal window open AirSonos stays running. It will receive the AirPlay stream from your phone and your computer will do the heavy lifting of transcending the stream to something Sonos can understand and play.

It isn't the best solution out there but it is something that works most of the time. The only problem I really have with it is really just the interface. Since Sonos treats the AirSonos stream like it would any other internet radio station you can't group or ungroup speakers like you can from the Sonos app.

Play around with it and you'll eventually get the hang of it. When I need a quick stream over to a nearby Sonos unit to listen to a podcast or music its just a quick command away and I don't need to cobble together a solution. As my use goes this works perfectly but it isn't reliable enough to be something that I would install in a customer's home unless they were a power user and really only had this option. 

Let me know what you think in the comments below or if you know of something easier/better to use. At this point I'm open to just about anything if it helps me listen to what I want on my Sonos.