How to listen to Spotify on the Raspberry Pi

Raspbian is the dominant operating system on the Raspberry Pi, and for good reason – it makes the tiny Raspberry Pi feel like a full-sized computer, giving users access a web browser, utilities, and even games. But Raspbian doesn’t support every program out of the box, and Spotify fans will be disappointed to learn that their Raspberry Pi can’t play Spotify in the Chromium web browser that comes standard on Raspbian. Luckily, we can perform a few tweaks to make Spotify work on our Raspberry Pi and send music out over your choice of the HDMI connection or the headphone jack, which is perfect for feeding into your stereo system’s auxiliary input. Here’s how to listen to Spotify on the Raspberry Pi.

How to listen to Spotify on the Raspberry Pi

For this project, you’ll need a Raspberry Pi and all of the basic peripherals: a screen, a keyboard, a mouse, a power supply, and a microSD card. You’ll also need a computer with an SD card slot. If you want to use the headphone jack to listen to Spotify, you’ll need headphones or an aux cable.

We’ll be using Raspbian and the Chromium web browser in this project, but as we’ll see, that’s not enough to start Spotify. What we have to do is download a specific Chrome extension that will trick Spotify into thinking that we’re running Microsoft’s Internet Explorer. With the help of this little white lie, Spotify will work fine on Chromium.

Step 1: Install Raspbian

First things first: this entire project takes place on Raspbian, so grab the disk image and put it on your microSD card. You can do this using the standard procedure for installing any operating system on the Raspberry Pi. Don’t remember that process? No problem – just check out our complete guide to installing Raspbian on the Raspberry Pi.

Once you have Raspbian installed, you’ll have a great operating system that you can use to perform basic computer functions (like word processing, web browsing, and more) or as the starting point to any of the nearly countless Pi projects that use Raspbian as their base. But one thing you won’t be able to do out of the box is use the included Chromium web browser to access Spotify’s web player. If you try, you’ll encounter a redirect or a screen that says: “Playback of protected content is not enabled.”

Bummer! Luckily for us, though, we have three more steps left in which to right this wrong. Let’s get started.

Loyal readers will remember this extension from our guide to watching Netflix on the Raspberry Pi. We’re using it for the same purpose this time around: we’ll be tricking the website we want to use into thinking that we’re running one of their supported browsers, even though we’re not. This is a Chrome extension, but like many Chrome extensions, it works fine on the lighter-weight Chromium browser as well.

Step 3: Pretend to be using Internet Explorer 10

Now we just need to choose our new “user agent” before we try to access Spotify’s web player. Internet Explorer 10 will work, so let’s go ahead and do that: navigate to Internet Explorer > Internet Explorer 10 in User-Agent Switcher for Chrome’s settings.

If you’re content to use the headphone jack, we’re really already done here! Now that Spotify is blissfully unaware that we’re using the Chromium web browser, it will play nice with us. By default, this project will send the audio out of your Raspberry Pi’s headphone jack (rather than its HDMI port), which means you’ll have to plug in an auxiliary cord or some headphones to enjoy your tunes. This makes it perfect, though, for connecting to a larger stereo system!

If you want to use the HDMI connection instead, you just have one simple step left. In your terminal, run the command sudo raspi-config. This will give you a menu in your terminal window. Navigate to Advanced Options > A4 Audio > Choose the audio output: 2 Force HDMI. That’s it!