So if you have used Spotify on Linux you will notice that there are often times where it will crash on start or act very broken after a launch and that seems to be primarily due to unwanted data being left in cache or config temps which seem to cause hangups.
Here is a special little bash script that makes Spotify work more smoothly and this especially makes the latest Beta with Spotify Apps work very nicely but can work in earlier versions as well:
#!/bin/bash
# Purge Spotify's ever horrible cache and temp config then run spotify
rm -Rf $HOME/.config/spotify && rm -Rf $HOME/.cache/spotify && spotify
For those who want to run this script as an application shortcut so it does tidying and then launches Spotify then simply do this from terminal:
1. nano spotify.sh
2. paste above code
3. chmod +x spotify.sh
4. Now sudo nano /usr/share/applications/spotify.desktop and paste this in:
[Desktop Entry]
Name=Spotify
GenericName=Music Player
Comment=Listen to music using Spotify
Icon=spotify-linux-512×512
Exec=/home/bkerensa/bin/spotify.sh
TryExec=spotify
Terminal=false
Type=Application
Categories=Qt;Audio;Music;Player;AudioVideo
MimeType=x-scheme-handler/spotify
Now whenever you click the Spotify icon in the Unity launcher or whatever DE on Ubuntu you happen to be using it should execute the spotify.sh script which will tidy up and then run Spotify.
Hope this is useful for some!
Originally Posted At: Benjamin Kerensa dot Com