The local profiles are stored in
~/Library/Group Containers/UBF8T346G9.Office/
Is that what you're looking to delete? The entire UBF8T346G9.Office directory? Or something more specific inside that?
If you want to delete the entire thing, then yes, it can be scripted. Something like the following should work, though this has not really been tested since I don't want to delete my Office 2016 folder, so be careful with it. Test only on a test machine to start with. There may be somewhat better ways to do this also.
#!/bin/bash
while read USER; do
if [ -d "${USER}/Library/Group Containers/UBF8T346G9.Office" ]; then
echo "Found Office 2016 container for $USER. Deleting..."
rm -Rf "${USER}/Library/Group Containers/UBF8T346G9.Office"
else
echo "Did not find Office 2016 container for $USER"
fi
done < <(find /Users -type d -maxdepth 1 -mindepth 1 | egrep -v "_mbsetupuser|Shared")
I will give that a try! I'm just looking to have the users profiles deleted, so it sounds like that could work for me
I am currently using the below for full Office 2016 removal which could be modified to only cover the user data removal /Users/$USERNAME/Library/Group Containers
#!/bin/bash
# commands out of the official guide from microsoft
# source https://support.office.com/en-us/article/Uninstall-Office-2016-for-Mac-eefa1199-5b58-43af-8a3d-b73dc1a8cae3
# and https://gist.github.com/pirafrank/18d62c062e2806c1d183
USERNAME=$(ls -l /dev/console | awk '{print $3}')
rm -rf "/Applications/Microsoft Excel.app"
rm -rf "/Applications/Microsoft OneNote.app"
rm -rf "/Applications/Microsoft Outlook.app"
rm -rf "/Applications/Microsoft PowerPoint.app"
rm -rf "/Applications/Microsoft Word.app"
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.errorreporting
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Excel
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.netlib.shipassertprocess
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Office365ServiceV2
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Outlook
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Powerpoint
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.rm -rfS-XPCService
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Word
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.onenote.mac
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.ms"
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.Office"
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost"
# further cleaning
rm -rf "/Library/Application Support/Microsoft/MAU2.0"
rm -rf "/Library/Fonts/Microsoft"
rm -rf /Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist
rm -rf /Library/LaunchDaemons/com.microsoft.office.licensingV2.helper.plist
rm -rf /Library/Preferences/com.microsoft.Excel.plist
rm -rf /Library/Preferences/com.microsoft.office.plist
rm -rf /Library/Preferences/com.microsoft.office.setupassistant.plist
rm -rf /Library/Preferences/com.microsoft.outlook.databasedaemon.plist
rm -rf /Library/Preferences/com.microsoft.outlook.office_reminders.plist
rm -rf /Library/Preferences/com.microsoft.Outlook.plist
rm -rf /Library/Preferences/com.microsoft.PowerPoint.plist
rm -rf /Library/Preferences/com.microsoft.Word.plist
rm -rf /Library/Preferences/com.microsoft.office.licensingV2.plist
rm -rf /Library/Preferences/com.microsoft.autoupdate2.plist
rm -rf /Library/Preferences/ByHost/com.microsoft
rm -rf /Library/Receipts/Office2016_*
rm -rf /Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper
rm -rf /Library/PrivilegedHelperTools/com.microsoft.office.licensingV2.helper
pkgutil --forget com.microsoft.package.Fonts
pkgutil --forget com.microsoft.package.Microsoft_AutoUpdate.app
pkgutil --forget com.microsoft.package.Microsoft_Excel.app
pkgutil --forget com.microsoft.package.Microsoft_OneNote.app
pkgutil --forget com.microsoft.package.Microsoft_Outlook.app
pkgutil --forget com.microsoft.package.Microsoft_PowerPoint.app
pkgutil --forget com.microsoft.package.Microsoft_Word.app
pkgutil --forget com.microsoft.package.Proofing_Tools
pkgutil --forget com.microsoft.package.licensing
Also believe the below one was obtained from Office 2016 team on macadmin slack channel
#!/bin/bash
USERNAME=$(ls -l /dev/console | awk '{print $3}')
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
echo -e "
###################################
Office 2016 for Mac uninstaller
###################################
"
sleep 4
echo -e "
------------- WARNING -------------
Your Outlook data will be wiped.
Press CTRL+C in 5 seconds to ABORT
-----------------------------------
"
sleep 6
# commands out of the official guide from microsoft
# source https://support.office.com/en-us/article/Uninstall-Office-2016-for-Mac-eefa1199-5b58-43af-8a3d-b73dc1a8cae3
echo " Removing Office 2016 apps..."
rm -rf "/Applications/Microsoft Excel.app"
rm -rf "/Applications/Microsoft OneNote.app"
rm -rf "/Applications/Microsoft Outlook.app"
rm -rf "/Applications/Microsoft PowerPoint.app"
rm -rf "/Applications/Microsoft Word.app"
echo " Cleaning ~/Library..."
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.errorreporting
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Excel
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.netlib.shipassertprocess
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Office365ServiceV2
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Outlook
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Powerpoint
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.rm -rfS-XPCService
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.Word
rm -rf /Users/$USERNAME/Library/Containers/com.microsoft.onenote.mac
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.ms"
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.Office"
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost"
# further cleaning
echo " Cleaning system folders..."
rm -rf "/Library/Application Support/Microsoft/MAU2.0"
rm -rf "/Library/Fonts/Microsoft"
rm -rf /Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist
rm -rf /Library/LaunchDaemons/com.microsoft.office.licensingV2.helper.plist
rm -rf /Library/Preferences/com.microsoft.Excel.plist
rm -rf /Library/Preferences/com.microsoft.office.plist
rm -rf /Library/Preferences/com.microsoft.office.setupassistant.plist
rm -rf /Library/Preferences/com.microsoft.outlook.databasedaemon.plist
rm -rf /Library/Preferences/com.microsoft.outlook.office_reminders.plist
rm -rf /Library/Preferences/com.microsoft.Outlook.plist
rm -rf /Library/Preferences/com.microsoft.PowerPoint.plist
rm -rf /Library/Preferences/com.microsoft.Word.plist
rm -rf /Library/Preferences/com.microsoft.office.licensingV2.plist
rm -rf /Library/Preferences/com.microsoft.autoupdate2.plist
rm -rf /Library/Preferences/ByHost/com.microsoft
rm -rf /Library/Receipts/Office2016_*
rm -rf /Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper
rm -rf /Library/PrivilegedHelperTools/com.microsoft.office.licensingV2.helper
echo " Making your Mac forget about Office 2016..."
pkgutil --forget com.microsoft.package.Fonts
pkgutil --forget com.microsoft.package.Microsoft_AutoUpdate.app
pkgutil --forget com.microsoft.package.Microsoft_Excel.app
pkgutil --forget com.microsoft.package.Microsoft_OneNote.app
pkgutil --forget com.microsoft.package.Microsoft_Outlook.app
pkgutil --forget com.microsoft.package.Microsoft_PowerPoint.app
pkgutil --forget com.microsoft.package.Microsoft_Word.app
pkgutil --forget com.microsoft.package.Proofing_Tools
pkgutil --forget com.microsoft.package.licensing
echo -e "
Complete!
Please Note: You may need to reinstall Microsoft Silverlight.
You can now remove icons from Dock (if any!).
"
fi
Thanks @sbirdsley , @mm2270 , I will try these out and see what works, much appreciated!
I'm pretty inexperienced with this - but I'm trying to run:
!/bin/bash
USERNAME=$(ls -l /dev/console | awk '{print $3}')
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.ms"
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.Office"
rm -rf "/Users/$USERNAME/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost"
just to nuke those folders from existence. it doesn't seem to work though when I run it. Am I missing something stupid? Don't I have to "close it out" somehow? I'm getting an unexpected EOF error.
@sbirdsley @Macmacmark hey, just curious, how is this office 2016 uninstall working? which one are you using or have used?