Sonos is pretty awesome. However on the software end of things some of their design decisions are questionable at best. Getting a computer to stream audio directly to Sonos can be a bit of a headache. Thankfully, another developer has already come along with a solution to the problem at hand.

Airsonos is Stephen Wan’s fix which involves using Apple’s Airplay to send audio to the Sonos system. However the setup may be quite tricky for most, so I’ve put together some easy to follow steps in order to get you started.

This article has been updated on January 3rd, 2015. If you followed the previous version of this article and are having issues, read troubleshooting at the bottom or contact me directly at contact@erikgriffin.io. September 13, 2017: If you are getting the error “Invalid key length” when trying to select Sonos as the output, you can follow the instructions here to fix the issue. Once I’m not so busy I will include those instructions here, or try to fix the problem directly.

1. Install Node.js

Airsonos is a Node package, so you’ll have to install Node for it to work. You can download an install package from their website. The installation is fairly straight forward.

2. Install Airsonos

Airsonos runs from your Mac’s terminal, so go ahead and open it up.

You can find it easily from Spotlight (Command+ Space)

Once you have a terminal window open, copy the following line in and press enter.

npm install airsonos -g

If all went well Airsonos is now installed on your system. Try typing in airsonos into the terminal press enter. You’ll have to do this every time you want to use airsonos so it might be a good idea to pin the terminal to your dock.

Now if you try playing some music from your computer you may hear it coming from your Sonos system. If not go to Sound under System Preferences and navigate to the Output tab. Select AirSonos from the options under ‘Select a device for sound output’.

Once inside the Sound settings select your AirSonos speakers from the Output tab.

And that’s it! Now everytime you want to use AirPlay with your Sonos system just open up a terminal window, type “airsonos” without the quotes and press enter. You can even use AirPlay from your phone while airsonos is running on your computer. There is about a 2 second delay of audio which you will notice immediately while watching a movie, so scroll down to read how we fix that.

Do note that you cannot directly use AirPlay from iTunes, it will throw an error if you try. Instead just make sure your system is configured to output sound through the AirSonos speakers.

Watching a Movie with Airsonos

The easiest way to do this is to use VLC. If you haven’t heard of it before it is an amazing video player that you have no excuse not to own. Go ahead and download it from their website.

More recently I’ve had some issues with the audio stuttering during playback. If this happens try deleting VLC and downloading an older version: 2.02 worked for me: VLC 2.02 download

Now once you’ve opened a movie with the VLC player while AirSonos is running, you’ll notice that the sound is way off. Luckily VLC has an audio offset function that you can access by pressing the ‘F’ or ‘G’ keys. Mine seems to always hover around -2450 ms, so that’s a good place to start. Press the F key until the number shows. You may have to play around with it a little to get it right on your system, but with some practice its not so hard.

Enjoy.