Skip to content

Instantly share code, notes, and snippets.

@minton
Created June 17, 2015 19:01
Show Gist options
  • Save minton/39b21dfab426ba1745b1 to your computer and use it in GitHub Desktop.
Save minton/39b21dfab426ba1745b1 to your computer and use it in GitHub Desktop.
Revert Spotify and prevent it from updating itself
#!/bin/sh
# @mcminton
# This script will download the appropriate version of Spotify and lock it from auto-updating itself
# This is needed to support AppleScript when running https://github.com/minton/Spot
# See https://community.spotify.com/t5/Help-Desktop-Linux-Mac-Windows/Revert-back-to-Spotify-0-8-5-on-Mac/m-p/325476/highlight/true#M35698
# Kill Spotify if it happens to be running
killall Spotify &> /dev/null
# Remove existing Spotify.dmg if needed
rm Spotify.dmg
echo "Uninstall existing Spotify..."
rm -r /Applications/Spotify.app
echo "Download archived Spotify..."
curl -L -o Spotify.dmg https://www.dropbox.com/s/88cdfti7qu57n14/Spotify.dmg?dl=0
echo "Mount DMG..."
hdiutil attach Spotify.dmg
sleep 4
echo "Copy to Applications folder..."
cp -R "/Volumes/Spotify/Spotify.app" /Applications
echo "Unmount..."
hdiutil detach "/Volumes/Spotify"
echo "Launch Spotify to create Application Support folders..."
echo "Please wait for Spotify to exit..."
open -a Spotify
sleep 3
killall Spotify
sleep 2
echo "Lock Spotify from updating itself..."
chflags nouchg ~/Library/Application\ Support/Spotify/Spotify_new.archive &> /dev/null
chflags nouchg ~/Library/Application\ Support/Spotify/Spotify_new.archive.sig &> /dev/null
rm ~/Library/Application\ Support/Spotify/Spotify_new.archive &> /dev/null
rm ~/Library/Application\ Support/Spotify/Spotify_new.archive.sig &> /dev/null
touch ~/Library/Application\ Support/Spotify/Spotify_new.archive
touch ~/Library/Application\ Support/Spotify/Spotify_new.archive.sig
chflags uchg ~/Library/Application\ Support/Spotify/Spotify_new.archive
chflags uchg ~/Library/Application\ Support/Spotify/Spotify_new.archive.sig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment