Skip to content

Instantly share code, notes, and snippets.

@alexcberk
Last active October 22, 2024 15:40
Show Gist options
  • Select an option

  • Save alexcberk/77c0bd68009ac7eb94d561e6a31570ae to your computer and use it in GitHub Desktop.

Select an option

Save alexcberk/77c0bd68009ac7eb94d561e6a31570ae to your computer and use it in GitHub Desktop.
spotifyd - headless setup on Mac Silicon

Setup spotifyd on Mac Silicon

Install rust

brew install rust

Build from source

git clone [email protected]:Spotifyd/spotifyd.git

cd spotifyd/

--

cargo build --release --no-default-features --features="portaudio_backend" && cargo install --path . --locked --no-default-features --features="portaudio_backend"

--

Add binary to ~/.zshrc

export PATH=$PATH:$HOME/.cargo/bin

Config file (Mac Silicon)

mkdir -p ~/.conf/spotifyd/

--

vim ~/.conf/spotifyd/spotifyd.conf

--

[global]
## Your Spotify account name.
username = ""

## Your Spotify account password.
password = ""

## A command that gets executed and can be used to
## retrieve your password.
## The command should return the password on stdout.
#
## This is an alternative to the `password` field. Both
## can't be used simultaneously.
## password_cmd = "command_that_writes_password_to_stdout"

## If set to true, `spotifyd` tries to look up your
## password in the system's password storage.
#
## This is an alternative to the `password` field. Both
## can't be used simultaneously.
## use_keyring = true

## If set to true, `spotifyd` tries to bind to dbus (default is the session bus)
## and expose MPRIS controls. When running headless, without the session bus,
## you should set this to false, to avoid errors. If you still want to use MPRIS,
## have a look at the `dbus_type` option.
use_mpris = false

## The bus to bind to with the MPRIS interface.
## Possible values: "session", "system"
## The system bus can be used if no graphical session is available
## (e.g. on headless systems) but you still want to be able to use MPRIS.
## NOTE: You might need to add appropriate policies to allow spotifyd to
## own the name.
dbus_type = "session"

## The audio backend used to play music. To get
## a list of possible backends, run `spotifyd --help`.
backend = "portaudio" ## use portaudio for macOS [homebrew]

## The alsa audio device to stream audio. To get a
## list of valid devices, run `aplay -L`,
## device = "alsa_audio_device"  ## omit for macOS

## The alsa control device. By default this is the same
## name as the `device` field.
## control = "alsa_audio_device"  ## omit for macOS

## The alsa mixer used by `spotifyd`.
## mixer = "PCM"  ## omit for macOS

## The volume controller. Each one behaves different to
## volume increases. For possible values, run
## `spotifyd --help`.
volume_controller = "softvol"  ## use softvol for macOS

## A command that gets executed in your shell after each song changes.
## on_song_change_hook = "command_to_run_on_playback_events"

## The name that gets displayed under the connect tab on
## official clients. Spaces are not allowed!
device_name = "shipium_macbook"

## The audio bitrate. 96, 160 or 320 kbit/s
bitrate = 320

## The directory used to cache audio data. This setting can save
## a lot of bandwidth when activated, as it will avoid re-downloading
## audio files when replaying them.
#
## Note: The file path does not get expanded. Environment variables and
## shell placeholders like $HOME or ~ don't work!
cache_path = "spotifyd_audio_cache"

## The maximal size of the cache directory in bytes
## The example value corresponds to ~ 1GB
max_cache_size = 1000000000

## If set to true, audio data does NOT get cached.
no_audio_cache = false

## Volume on startup between 0 and 100
## NOTE: This variable's type will change in v0.4, to a number (instead of string)
initial_volume = "40"

## If set to true, enables volume normalisation between songs.
volume_normalisation = true

## The normalisation pregain that is applied for each song.
normalisation_pregain = -10

## After the music playback has ended, start playing similar songs based on the previous tracks.
autoplay = true

## The port `spotifyd` uses to announce its service over the network.
zeroconf_port = 9070

## The proxy `spotifyd` will use to connect to spotify.
## proxy = "http://proxy.example.org:8080"

## The displayed device type in Spotify clients.
## Can be unknown, computer, tablet, smartphone, speaker, t_v,
## a_v_r (Audio/Video Receiver), s_t_b (Set-Top Box), and audio_dongle.
device_type = "speaker"

Run the Daemon

spotifyd

Debug daemon errors

spotifyd --no-daemon --verbose

Troubleshooting

portaudio binaries not found

brew install portaudio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment