Building from source

The guide below assumes that you're building spotifyd on the system that you want to run it on. If you'd instead prefer to cross-compile, head over to this section.

You can also compile spotifyd yourself, allowing you to tailor it perfectly to your needs or get the latest fixes. spotifyd is written in Rust. You can download the toolchain (compiler and package manager) over at rustup.rs. Follow their instructions to get started.

Note: Please make sure that you compile the package using the most recent stable version of Rust available through rustup. Some distro versions are quite outdated and might result in compilation errors.

Required packages

spotifyd might require additional libraries during build and runtime, depending on your platform and the way to compile it (static or dynamic). The following table shows the libraries needed for each OS respectively.

Target PlatformLibraries
Fedoraalsa-lib-devel make gcc
openSUSEalsa-devel make gcc
Debianlibasound2-dev libssl-dev libpulse-dev libdbus-1-dev
Archbase-devel alsa-lib libogg libpulse dbus
macOSdbus pkg-config portaudio

If you're building on a non-standard target, for example the RaspberryPi, you might need an additional libclang-dev and cmake package for one of our dependencies. Details can be found on this page.

Installing with cargo

To build and install the latest version of spotifyd, you can use the package manager for rust. The base command is the following

cargo install spotifyd --locked

If you would rather install from the latest commit on GitHub, download or clone the project, enter the directory and run

cargo install --path . --locked

Note: Both methods will install the binary in $XDG_DATA_HOME/cargo/bin or $HOME/.cargo/bin. To execute it, you must make sure that this location is part of your shell's $PATH variable. Also, you might have to change the paths when following other parts of this documentation.

Compiling with cargo

To just build the binary without installing, run

cargo build --release --locked

This will build the binary and leave the result at ./target/release/spotifyd.

Building a Debian package

You can use the cargo-deb crate in order to build a Debian package from source. Install it by:

cargo install cargo-deb

Then you can build and install the Debian package with:

cargo deb --install

Note, that when building a Debian package, the --release is passed to the build command already and you do not need to specify it yourself. See for the flags that are set by default in Cargo.toml.

Feature Flags

spotifyd is split into a base package plus additional features that can be toggled on or off during compilation. Those can be split into two groups: The audio backend features that are responsible for playing back the music and additional functionality features, which enhance your experience using spotifyd.

Feature FlagDescription
alsa_backendProvides support for the ALSA backend. Should work in most setups and is enabled by default.
pulseaudio_backendSupport for PulseAudio.
rodio_backendRust-native implementation of audio backends on all platforms. Does not need any external packages to be installed.
portaudio_backendAudio backend that can be used on non-Linux systems.
rodiojack_backendSupport for the Jack backend.
dbus_mprisProvides multimedia key support (Linux and BSD only)

To customize your build, pass a subset of the features listed above to any of the cargo commands above via --features <feature1>,<feature2>,.... Disable the default feature alsa_backend with --no-default-features. So an example command could look like the following:

cargo install spotifyd --locked --no-default-features --features rodio_backend,dbus_mpris