Skip to content

Instantly share code, notes, and snippets.

@fvoges
Last active March 24, 2023 10:38
Show Gist options
  • Save fvoges/68c217c5f504266e09eb02b936be61ea to your computer and use it in GitHub Desktop.
Save fvoges/68c217c5f504266e09eb02b936be61ea to your computer and use it in GitHub Desktop.
Uninstall macOS Office365
#!/bin/bash
# Source: https://community.jamf.com/t5/jamf-pro/how-to-remove-office-365-completely/m-p/254634/highlight/true#M236360
consoleuser=$(ls -l /dev/console | awk '{ print $3 }')
echo "logged in user is" $consoleuser
echo "Kill Microsoft Office Process..."
pkill -f Microsoft
folders=(
"/Applications/Microsoft Excel.app"
"/Applications/Microsoft OneNote.app"
"/Applications/Microsoft Outlook.app"
"/Applications/Microsoft PowerPoint.app"
"/Applications/Microsoft Word.app"
"/Applications/Microsoft Teams.app"
"/Applications/OneDrive.app"
"/Library/Application Support/Microsoft"
#
"/Users/$consoleuser/Library/Application\ Support/Microsoft AU Daemon"
"/Users/$consoleuser/Library/Application\ Support/Microsoft AutoUpdate"
"/Users/$consoleuser/Library/Application\ Support/com.microsoft.OneDriveStandaloneUpdater/"
"/Users/$consoleuser/Library/Application\ Support/Microsoft\ Update\ Assistant/"
"/Users/$consoleuser/Library/Preferences/com.microsoft.autoupdate.fba.debuglogging.plist"
"/Users/$consoleuser/Library/Preferences/com.microsoft.autoupdate.fba.plist"
"/Users/$consoleuser/Library/Preferences/com.microsoft.autoupdate2.plist"
"/Users/$consoleuser/Library/Preferences/com.microsoft.office.plist"
"/Users/$consoleuser/Library/Preferences/com.microsoft.OneDriveStandaloneUpdater.plist"
"/Users/$consoleuser/Library/Preferences/com.microsoft.OneDriveUpdater.plist"
"/Users/$consoleuser/Library/Preferences/com.microsoft.shared.plist"
"/Users/$consoleuser/Library/Containers/com.microsoft.errorreporting"
"/Users/$consoleuser/Library/Containers/com.microsoft.Excel"
"/Users/$consoleuser/Library/Containers/com.microsoft.netlib.shipassertprocess"
"/Users/$consoleuser/Library/Containers/com.microsoft.Office365ServiceV2"
"/Users/$consoleuser/Library/Containers/com.microsoft.Outlook"
"/Users/$consoleuser/Library/Containers/com.microsoft.Powerpoint"
"/Users/$consoleuser/Library/Containers/com.microsoft.RMS-XPCService"
"/Users/$consoleuser/Library/Containers/com.microsoft.Word"
"/Users/$consoleuser/Library/Containers/com.microsoft.onenote.mac"
#
#
#### WARNING: Outlook data will be removed when you move the three folders listed below.
#### You should back up these folders before you delete them.
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.ms"
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.Office"
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost"
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.OfficeOneDriveSyncIntegration"
)
search="*"
for i in "${folders[@]}"
do
echo "removing folder ${i}"
rm -rf "${i}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment