Sign in as a Carbon or Silicon

The daemon

spotify-daemon is the always-on half of spotify-cli. There is one per macOS user (one Spotify.app per user), shared by every Silicon home on the machine.

What it does:

JobHow
Watch Spotify.appSpotify's com.spotify.client.PlaybackStateChanged notification (play, pause, track change) plus AppleScript readings on an adaptive timer: 2 s while playing with triggers or a queue, 5 s playing, 10 s paused, 15 s closed (3 s in the daemon's first two minutes until an Apple Event has reached Spotify, so macOS's permission question comes soon after Spotify starts during an install), and precisely at the next checkpoint
Run AppleScriptin-process NSAppleScript on the main thread, each script compiled once (~50 ms per read, no process spawn)
Fire triggersthe pure trigger engine; firings go to a durable outbox
Deliver Tingsopens the creating Silicon's session under its lock, refreshes if needed, sends through the backend; retries with backoff for an hour
Managed queuehands over to the next queued item at the end of each song, resumes the interrupted context; next, play <item>, previous and hand-offs reach Spotify one at a time, never interleaved. When a hand-off brings Spotify.app to the front, the focus goes back (keep_spotify_in_background)
Warm spotify_playerkeeps one headless instance on a pseudo-terminal so Web API calls take ~20 ms, with its view of playback refreshed every 20 s (below)
Library readsretries a library or playlist read once after a network blip, and makes reads right after a change wait until they can see it (below)
Updateschecks GitHub releases hourly and installs verified updates (script installs; Silicon Apps updates its own installs)

Commands

Terminalsh
spotify daemon status       # version, uptime, Spotify state, triggers, deliveries, warm player, updates
spotify daemon start        # launchd when installed, else a detached process
spotify daemon install      # launchd agent com.unlikefraction.spotify.daemon (start at login, KeepAlive)
spotify daemon restart
spotify daemon logs --lines 100
spotify daemon stop
spotify daemon uninstall

The CLI starts the daemon on demand, and when the CLI is newer than the running daemon it restarts it, so an updated binary takes over immediately.

Files

~/.silicon-spotify/ is the daemon's state directory: one per macOS user, whatever SILICON_HOME says.

Texttext
~/.silicon-spotify/            (SPOTIFY_DAEMON_HOME overrides; directory 0700)
  daemon.sock                  Unix socket (0600); JSON lines, one request per connection
  daemon.lock                  single-instance lock (kept forever)
  daemon.sqlite                triggers, firings/outbox, managed queue, tracker, settings (0600)
  daemon.log                   log (launchd and the CLI launcher append here)
  spotify-auth.log             output of `spotify auth login`
  install.json                 written by the installer or Silicon Apps: method, directory, version
  warm-player.json             pid and start time of the warm spotify_player this daemon started
~/Library/LaunchAgents/com.unlikefraction.spotify.daemon.plist

Per Silicon home ($SILICON_HOME/.spotify/, else ~/.spotify/): config.json, session.json, session.lock. The daemon reads a home's session only to deliver that home's triggers. Removing all of it: spotify docs usage (Uninstall).

The warm spotify_player

spotify_player's CLI hands each command over UDP to the one running instance that holds its client port (127.0.0.1:8080 unless client_port in its app.toml says otherwise), or starts a throwaway client (~1.5 s) when none answers. The daemon runs one copy of its own, headless, on a pseudo-terminal it owns, with streaming, media keys and notifications off, so it never becomes a playback device and only answers Web API commands.

spotify daemon status (warm_spotify_player in --json) says what it is doing, in words:

StateMeaning (--json fields)
runningthe copy holds the client port and serves spotify-cli (pid, port, refresh_ms, port_owner_pid, serves_cli)
startingstarted, waiting for it to take the port (pid, port)
not_servingit never got the port; stopped, retried later (port_owner, retry_in_s)
deferredanother process, usually your own spotify_player, holds the port (port_owner: pid, parent_pid, kind, command; since)
restartingit exited; a new copy starts soon (last_exit, retry_in_s)
failed, unavailableit cannot start (error)
waiting_for_spotify_authspotify_player is not signed in: spotify auth login
disabledSPOTIFY_WARM_PLAYER=off (reason)

spotify doctor's spotify_player_warm_instance check passes only when the daemon's own copy holds the client port; its detail adds port_owner_pid_now. It is not required (shown with ·): commands work without it, only slower. When it fails the human output adds state: <the state in words>, and when the daemon's copy runs but another process holds the port, that line ends with the port is held by pid N now.

Library and playlist reads

Permissions

macOS asks once whether spotify-daemon may control Spotify (Automation). The daemon's first reading of a running Spotify raises the question, and the installer waits for the answer, because while that dialog is open macOS holds every Apple Event to Spotify, from any app. Until someone clicks Allow, commands fail with timeout, whose hint names the dialog. After one timeout the daemon fails fast for 3 s instead of queueing, and commands already waiting behind it fail fast too.

spotify daemon status shows what the Apple Events so far say (automation in --json):

StateMeaning
grantedan Apple Event reached Spotify
deniedmacOS refused (automation_permission_denied)
not_answeringSpotify did not answer: usually the dialog is open (it may be behind other windows)
unknownno Apple Event has reached a running Spotify yet (Spotify is closed), or the Spotify that stopped answering has quit

A reading that finds Spotify closed sends no Apple Event, so it never counts as granted. spotify doctor reports automation_permission: failing for denied and not_answering, and optional (·) for unknown, with the fix: start Spotify (spotify launch), then run spotify doctor again. The doctor waits out any remaining 3 s fail-fast window first, so it really re-checks.

If you clicked Don't Allow: System Settings → Privacy & Security → Automation → spotify-daemon → turn on Spotify (the automation_permission_denied hint says the same). The spotify command never sends Apple Events itself (see the end of this section); spotify-daemon does, and macOS files the answer under the app responsible for the daemon's process. That is spotify-daemon when launchd runs it (spotify daemon install, which the installer and spotify setup do). A daemon started from a terminal (spotify daemon run, or started on demand by a spotify command while no launchd agent is installed) belongs to that terminal app, so macOS asks for, and lists, the terminal (Terminal, iTerm, …) instead: turn on Spotify under its entry, or run spotify daemon install so launchd runs the daemon. If spotify-daemon is not listed or no prompt ever appears, try resetting only the daemon's Automation answers, then retry so macOS asks:

Terminalsh
tccutil reset AppleEvents com.unlikefraction.spotify-daemon

com.unlikefraction.spotify-daemon is the daemon's code-signing identifier; check it with codesign -dv "$(command -v spotify-daemon)" (the Identifier= line). spotify-daemon is a plain executable, not an app bundle, so tccutil may answer No such bundle identifier. The only other reset is tccutil reset AppleEvents with no identifier, which forgets the Automation answers of every app on the Mac, so each of them asks again.

macOS remembers the answer for the daemon's signature. Releases after 0.1.4 are signed with the project's Developer ID (team LTBSK59BJ2, hardened runtime) and notarized by Apple, so the Allow survives updates; the first such release asks once more after an ad-hoc signed one. Check with codesign -dv "$(command -v spotify-daemon)": TeamIdentifier=LTBSK59BJ2 and flags=0x10000(runtime). Builds you make yourself (cargo build, or scripts/package-release.sh without SPOTIFY_CODESIGN_IDENTITY) are ad-hoc signed: that signature changes with every build, so macOS may ask again after each one. Click Allow.

The daemon carries an embedded Info.plist (bundle identifier com.unlikefraction.spotify-daemon, and the reason macOS shows in the prompt) and, in signed releases, the one entitlement the hardened runtime needs for Apple Events (com.apple.security.automation.apple-events). The spotify command sends no Apple Events itself; it asks the daemon.

Security

The socket is owner-only inside an owner-only directory, and both sides check the peer runs as the same user. The daemon holds no credentials of its own; Silicon sessions stay in each home. It reads spotify_player's cached Spotify access tokens only for what spotify_player has no command for or cannot do: starting songs, episodes, shows and Liked Songs in the background, a search when spotify_player's fails, and a few lookups (spotify docs auth). It sends them only to api.spotify.com and never logs them. The CLI, daemon, backend, and website do not collect or send usage analytics or diagnostic events. Updating the daemon removes its old event backlog.

Offline: spotify docs daemon · Source: docs/daemon.md