Skip to content

Instantly share code, notes, and snippets.

@Roman2K
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Roman2K/eee9c6432d617dd42434 to your computer and use it in GitHub Desktop.
Save Roman2K/eee9c6432d617dd42434 to your computer and use it in GitHub Desktop.
Delete system apps to free up precious disk space in OS X Yosemite - http://forums.macrumors.com/showthread.php?p=20328653
#!/usr/bin/env bash
files=(
"/Applications/iMovie.app"
"$HOME/Library/iMovie"
/Applications/Photos.app
/Users/roman/Pictures/Photos\ Library.photoslibrary
"/Users/roman/Library/Preferences/com.apple.Photos.LSSharedFileList.plist"
"/Applications/GarageBand.app"
"/Library/Application Support/GarageBand"
$HOME/Music/GarageBand
"/Applications/Keynote.app"
"/Applications/Pages.app"
"$HOME/Library/Containers/com.apple.iWork.Pages"
"/Applications/Numbers.app"
"/Applications/iTunes.app"
"$HOME/Music/iTunes"
"/Library/iTunes"
"$HOME/Library/iTunes"
"$HOME/Library/Preferences/com.apple.iTunes.plist"
"$HOME/Library/Preferences/com.apple.iTunesHelper.plist"
$HOME/Pictures/iPod\ Photo\ Cache
"/Applications/iBooks.app"
/Applications/Chess.app
)
avail_mb() {
df -m / | tail -1 | awk '{ print $4 }'
}
before=$(avail_mb)
for f in "${files[@]}"; do
if [ -e "$f" ]; then
echo "deleting $f"
sudo rm -rf "$f" || break
fi
done
after=$(avail_mb)
freed_up=$(ruby -e 'b,a,=ARGV.map(&:to_i); puts "%.1fGB" % [(a-b)/1024.0]' $before $after)
echo "Freed up $freed_up"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment