As it stands Spotify have not released an official client for the varying BSD platforms. Unfortunately due to the small userbase from the BSDs and feasibility in porting such an application (requiring operating-system specific DRM), the likelihood of Spotify jumping through these complexities is very unlikely.
Other than the client provided by Spotify via a distributed binary there's also the web frontend. However, FreeBSD lacks the necessary DRM support and more specifically Widevine—mandatory browser plugin to stream music on Spotify and similarly watch content on Netflix via your browser. There's been efforts to get it working but isn't practical by any means, ultimately it comes down to a binary blob that's incompatible with FreeBSD. Widevine came out with the following statement:
"FreeBSD is not a supported platform, we have no plans or demands from content provider partners. Please consider reaching out to your streaming provider to request client support which will eventually get to us."
Luckily, Spotify has a neat little Web API which can be used to our advantage, and subsequently provide us with a Spotify experience, but within the terminal. With the combination of both audio/spotify-tui and audio/spotifyd we can achieve this.
Spotify-tui uses the Web API from Spotify, which doesn't handle streaming itself. So you'll need either an official Spotify client open or a lightweight alternative such as spotifyd (what we will be using). You can think of Spotify-tui as more of a "controller" or "frontend" to Spotify, with this setup you can control all your Spotify devices.
Spotifyd streams music just like the official client, but is more lightweight and supports more platforms. Spotifyd also supports the Spotify Connect protocol, which makes it show up as a device that can be controlled from the official clients.
If you want to play tracks, Spotify requires that you have a premium account.
For this instance, we will be using portaudio as the audio backend and is the default for spotifyd—by far the simplest too.
# pkg install spotify-tui spotifydor from the ports collection
# make -C /usr/ports/audio/spotify-tui install clean # make -C /usr/ports/audio/spotifyd install clean
As your desired user, edit ~/.config/spotifyd/spotifyd.conf or globally /usr/local/etc/spotifyd.conf, and ensure it contains the bare minimum:
[global] username = example.com # Your Spotify email here password = foobar # Your Spotify password here backend = portaudio device = /dev/dsp5.0 # Rename to the according audio device device_name = bsd # Name the device as you please
Optionally you can pass the username, password, device, etc in the terminal (using the configuration above for example):
$ spotifyd --username example.com --password foobar --backend portaudio --device /dev/dsp5.0 --device-name bsd
For further help and configuration options, flags and usages view the help page with the -h flag or visit here to see the full configuration file documentation.
- Now start spotifyd and enjoy:
$ spotifyd --no-daemon
By default spotifyd will take precedence (~/.config/spotifyd/spotifyd.conf) over the configuration in /usr/local/etc, you can override this by passing --config-path and then the configuration file you wish to use.
Start up spt (the executable for spotify-tui) within a terminal, press d and select your local device (what you set as device_name in the configuration file) by pressing enter, then q to go back to the previous screen. You can now play your favorite music and playlists from Spotify directly in your terminal.
Alternatively to start spotifyd automatically upon boot, rather than starting it manually through the terminal:
# sysrc spotifyd_enable=YES # sysrc spotifyd_config="/path/to/config" # spotifyd.conf residing under /usr/local/etc is used as default here.
For theming, keybinding and custom behaviors for spotify-tui see here.