DJs, you can download Spotify Playlists on Your Mac with spotDL

Tom Lynch

Welcome, music enthusiasts! This guide is designed to help you easily download Spotify playlists to your Mac using spotdl spotify-downloader, even if you're new to using command-line tools.

Understanding the Basics

What is Terminal?

Navigating Folders in Terminal

Installation: Setting up the Essentials

First, let's install the necessary tools. We will install Homebrew first, as it simplifies the installation of FFmpeg.

1. Install Homebrew (The Package Manager)

Homebrew simplifies the installation of software on Mac. Run this in terminal by pasting it in and pressing enter:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2. Install FFmpeg (The Audio Processor)

FFmpeg is required by spotdl for processing audio files. Install it using Homebrew (again paste and hit enter in terminal):

brew install ffmpeg

3. Install Python 3 (If needed) & spotDL

Python 3 is usually pre-installed on modern Macs, as is its package manager, pip3. If you need to install Python, you can find it here: Python.

Let's get spotdl spotify-downloader set up on your Mac (in terminal):

pip3 install spotdl

Creating a Download Folder

Now, create a folder for your downloads:

Downloading a Spotify Playlist

Now you're ready to download your Spotify playlists:

  1. To get the Spotify playlist URL, go to the playlist in Spotify, click the three dots, 'Share', then 'Copy link to playlist'. Edit the link to remove everything after the "?".
  2. In Terminal, type:
    spotdl [Clean Spotify Playlist Link]
    Replace [Clean Spotify Playlist Link] with your link.

Troubleshooting Common Issues

Issue: Resolving Future Upgrade Problems (KeyError: 'header')

The underlying issue for most download problems is that YouTube frequently updates how it serves audio and video data, which often breaks external tools like spotdl until their developers release a fix. You'll know this is the issue if you get a Python error message that includes KeyError: 'header'.

This error means your installed versions are too old to understand YouTube's new structure. While running a simple pip3 install -U spotdl should fix it, sometimes pip caches an older version and fails to get the proper update.

To solve this during future upgrades, you need to clear your pip cache and then re-run the installation command:

  1. Clear the pip Cache: This command clears all locally cached package files, forcing pip to download everything fresh from the internet.

    pip3 cache purge
  2. Re-run the Installation/Update Command: Now, run the update command one more time to fetch and install the latest available versions, explicitly targeting spotdl and the package that caused the error, ytmusicapi.

    pip3 install -U spotdl ytmusicapi --break-system-packages

    Note: The --break-system-packages flag is often needed on modern macOS systems to allow installation outside of the system's protected Python environment.

Conclusion

Congratulations! You've now downloaded Spotify playlists to your Mac. Any questions or issues? Drop a comment below. Enjoy your music!

Optional: Downloading Higher Bitrate Music using YouTube Music

For better sound quality, spotdl enables downloads from YouTube Music at 256kbps.

Requirements

Obtaining Cookies

Setting Up for High-Quality Downloads

  1. Change Quality Settings in YouTube Music.
  2. Use the --cookie-file option in your spotDL command, pointing to your cookies file.
  3. Select M4A or OPUS format with the --format option.
  4. Use --bitrate disable to skip bitrate conversion.

Example Command

spotdl --cookie-file path/to/your/cookies.txt --bitrate disable --audio youtube-music --format=m4a [Spotify Playlist Link]

For more details, check the spotDL documentation.

resumes:

Related blogs