Spotify TUI is a Spotify client for the terminal, written in Rust.
In conjuction with Spotifyd, a lighteight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account.
Install Spotifyd
Installation on Arch Linux
There are pre-build libraries for different operating systems. For Arch, you can find several packages in the AUR.
I use pulseaudio as my sound server, so I chose spotifyd-pulseaudio-git
from the AUR:
yay -S spotifyd-pulseaudio-git
Installation takes a while. The program first runs an installation of Rust and then builds the package.
Installation on macOS
Installation via Homebrew:
brew install spotifyd
brew services start spotifyd
Configuration
Create a configuration file ~/.config/spotifyd/spotifyd.conf
:
[global]
# Your Spotify account name.
username = bob
# Your Spotify account password.
password = password123
# backend
backend = pulseaudio
If you are uncomfortable with saving your password as plain text, you can use alternatives like a keyring or a command that fetches the password.
I like to use pass, so my configuration for Arch Linux (and MacOs) looks like this
[global]
username = "<my-username>"
password_cmd = "pass spotify/spotifyd"
backend = "portaudio" #for macos, for Linux I use "pulseaudio"
device_name = "spotifyd"
bitrate = 320
cache_path = "/Users/<my-username>/.cache/spotifyd"
volume-normalisation = true
normalisation-pregain = -10
device_type = "computer"
Running Spotifyd on Arch Linux
Create a systemd user script ~/.config/systemd/user/spotifyd.service
:
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12
[Install]
WantedBy=default.target
Then enable and start the script:
systemctl --user enable spotifyd --now
Spotify TUI
Installation on Arch Linux
For Arch, use the AUR:
yay -S spotify-tui
Installation on macOs
Installation on macOS via homebrew:
brew install spotify-tui
Configuration
Follow the guide from the official docs:
- Go to the Spotify dashboard
- Click Create a Client ID and create an app
- Now click Edit Settings
- Add
http://localhost:8888/callback
to the Redirect URIs- You are now ready to authenticate with Spotify!
- Go back to the terminal
- Run
spt
- Enter your Client ID
- Enter your Client Secret
- You will be redirected to an official Spotify webpage to ask you for permissions.
- After accepting the permissions, you’ll be redirected to localhost. If all goes well, the redirect URL will be parsed automatically and now you’re done. If the local webserver fails for some reason you’ll be redirected to a blank webpage that might say something like “Connection Refused” since no server is running. Regardless, copy the URL and paste into the prompt in the terminal.
After you’ve run spt
for the first time, you’ll find a configuration file under ~/.config/spotify-tui/client.yml
.
Connect With Spotifyd
Make sure that spotifyd.service
is running:
systemctl --user status spotifyd.service
Run spt
and select a song. Hit Enter
.
Spotify TUI will now complain that it doesn’t find a device. Press d
and the CLI should show the Spotifyd client. Select it with Enter
.
Now it should work.
Troubleshooting Spotifyd on macOS
brew services # is spotifyd running?
spotifyd ---verbose --no-daemon # logging