Home » Tech » Mac » Remove iWork ’09 via script
          

Remove iWork ’09 via script

Found an applescript written by Yvan KOENIG to remove iWork ’09 from a machine. Have converted it to bash so it can more easily be deployed via ARD and as a pre-flight to the installation package in munki.

#!/bin/sh

rm -rf "/Library/com.apple.iWork09.Installer.plist"
rm -rf "/Library/com.apple.iWork09.plist"
rm -rf "/Library/Application Support/iWork '09/"
rm -rf "/Library/Receipts/iWork09Trial.pkg"
rm -rf "/Library/Documentation/Help/iWorkFunctionsHelp.help"
rm -rf "/Applications/iWork '09/"
rm -rf "/Applications/Keynote.app "
rm -rf "/Applications/Numbers.app "
rm -rf "/Applications/Pages.app "

defaultprofile="/System/Library/User Template/English.lproj"

rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Fonts"
rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Keynote"
rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Numbers"
rm -rf "$defaultprofile""/Library/Caches/com.apple.iWork.Pages"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Keynote.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Numbers.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Pages.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Keynote.LSSharedFileList.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Numbers.LSSharedFileList.plist"
rm -rf "$defaultprofile""/Library/Preferences/com.apple.iWork.Pages.LSSharedFileList.plist"
rm -rf "$defaultprofile""/Applications/iWork '09/"
rm -rf "$defaultprofile""/Applications/Keynote.app"
rm -rf "$defaultprofile""/Applications/Numbers.app"
rm -rf "$defaultprofile""/Applications/Pages.app"

for userNames in /Users/*
do
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Fonts"
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Keynote"
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Numbers"
rm -rf "/Users/$userNames/Library/Caches/com.apple.iWork.Pages"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Keynote.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Numbers.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Pages.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Keynote.LSSharedFileList.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Numbers.LSSharedFileList.plist"
rm -rf "/Users/$userNames/Library/Preferences/com.apple.iWork.Pages.LSSharedFileList.plist"
rm -rf "/Users/$userNames/Applications/iWork '09/"
rm -rf "/Users/$userNames/Applications/Keynote.app"
rm -rf "/Users/$userNames/Applications/Numbers.app"
rm -rf "/Users/$userNames/Applications/Pages.app"
done

exit 0