-
-
Save pirafrank/18d62c062e2806c1d183 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
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 | |
################################### | |
Unofficial unistaller | |
Brought to you by Frank Pira | |
(fpira.com) | |
This software comes with absolutely | |
NO WARRANTY | |
Use it at your own risk. | |
" | |
sleep 4 | |
echo -e " | |
------------- WARNING ------------- | |
Your Outlook data will be wiped. | |
Press CTRL+C in 5 seconds to ABORT | |
or just sit back and relax! | |
----------------------------------- | |
" | |
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 /Users/$(whoami)/Library/Containers/com.microsoft.errorreporting | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.Excel | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.netlib.shipassertprocess | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.Office365ServiceV2 | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.Outlook | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.Powerpoint | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.RMS-XPCService | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.Word | |
rm /Users/$(whoami)/Library/Containers/com.microsoft.onenote.mac | |
rm "/Users/$(whoami)/Library/Group ContainersUBF8T346G9.ms" | |
rm "/Users/$(whoami)/Library/Group ContainersUBF8T346G9.Office" | |
rm "/Users/$(whoami)/Library/Group ContainersUBF8T346G9.OfficeOsfWebHost" | |
# further cleaning | |
echo " Cleaning system folders..." | |
rm -rf "/Library/Application Support/Microsoft/MAU2.0" | |
rm -rf "/Library/Fonts/Microsoft" | |
rm /Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist | |
rm /Library/LaunchDaemons/com.microsoft.office.licensingV2.helper.plist | |
rm /Library/Preferences/com.microsoft.Excel.plist | |
rm /Library/Preferences/com.microsoft.office.plist | |
rm /Library/Preferences/com.microsoft.office.setupassistant.plist | |
rm /Library/Preferences/com.microsoft.outlook.databasedaemon.plist | |
rm /Library/Preferences/com.microsoft.outlook.office_reminders.plist | |
rm /Library/Preferences/com.microsoft.Outlook.plist | |
rm /Library/Preferences/com.microsoft.PowerPoint.plist | |
rm /Library/Preferences/com.microsoft.Word.plist | |
rm /Library/Preferences/com.microsoft.office.licensingV2.plist | |
rm /Library/Preferences/com.microsoft.autoupdate2.plist | |
rm -rf /Library/Preferences/ByHost/com.microsoft | |
rm -rf /Library/Receipts/Office2016_* | |
rm /Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper | |
rm /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 " | |
All done! | |
You may need to reinstall Microsoft Silverlight. | |
You can now remove icons from Dock (if any!). | |
" | |
fi | |
Do you have or know of a 2008 version?
Hi Pira, when I run this with sudo, it seems $(whoami)
becomes root
and it didn't clean up the folders, as well as just simply using rm
seems like it's not going to remove the folder without forcing it.
Are the lines on Group Containers such as:
rm "/Users/$(whoami)/Library/Group ContainersUBF8T346G9.ms"
missing a trailing slash after Containers?
@rhortal Yes they do.
Nice one, thanks a lot for this script. I had a big issue with OneNote. Unable to open it, even after an uninstall an clean install. Different solutions on The Net didn't fix it. I ran this script, reinstalled Office and no issue at all anymore. Saved my work and saved the day!
Great!
I ran it under sudo privilege, but still can't clear sys files, showing no such directory or files
Perhaps this could be fleshed out to avoid issues with sudo as done in the Remove2011 project: https://github.com/pbowden-msft/Remove2011/blob/master/Remove2011#L238
function RemoveUserComponent {
FUNCPATH="$1"
FUNCTEXT="$2"
LogMessage "In function 'RemoveUserComponent with arguments $FUNCPATH and $FUNCTEXT'"
for u in `ls /Users`; do
FULLPATH="/Users/$u/$FUNCPATH"
$(sudo rm -r -f $FULLPATH)
done
}
Also, this fork seems like it solves a lot of the issues:
https://gist.github.com/pythoninthegrass/9e4d3ef0f2036746467add17c76b4c15
Also, this fork seems like it solves a lot of the issues:
https://gist.github.com/pythoninthegrass/9e4d3ef0f2036746467add17c76b4c15
Hey @radusuciu,
WAAAAY late to the party. Needed my / @pirafrank's script again for work and went down the rabbit hole of refactoring the last version I posted. Now pkgutil
actually forgets PLISTs (fixed incorrect operator), array that pkgutil
uses is now dynamic instead of a fixed list, /Applications are now correctly removed due to quirky .app extension behavior (directories vs. files), and lastly, all echo[es]
calling array items have been replaced with printf
to capture all the output instead of the first line.
Hope you find that useful. Pull requests welcome!
Thanks for the notes @pythoninthegrass!
To be honest, I forget why I was even looking at this in the first place 🎈
You're welcome, @radusuciu! Stealing that red balloon emoji -- gonna work its way into Slack convos somehow.
Nice work!
However, I found an issue when I use this script to uninstall my Office for Mac 2016 (version 15.20), it leaves two packages named 'com.microsoft.package.Frameworks' and 'com.microsoft.pkg.licensing' behind, it seams like Microsoft has made some change there, maybe we should also use
pkgutil
to forget those two, right?