Skip to content

Instantly share code, notes, and snippets.

@RobFreiburger
Created June 16, 2011 04:51
Office 2011 for Mac Uninstaller
#!/bin/sh
# Credit to http://www.officeformachelp.com/office/install/remove-office/
osascript -e 'tell application "Remote Desktop Connection" to quit'
osascript -e 'tell application "Microsoft Document Connection" to quit'
osascript -e 'tell application "Microsoft Messenger" to quit'
osascript -e 'tell application "Microsoft Communicator" to quit'
osascript -e 'tell application "Microsoft Outlook" to quit'
osascript -e 'tell application "Microsoft Excel" to quit'
osascript -e 'tell application "Microsoft PowerPoint" to quit'
osascript -e 'tell application "Microsoft Word" to quit'
osascript -e 'tell application "Microsoft Office Reminders" to quit'
osascript -e 'tell application "Microsoft AU Daemon" to quit'
osascript -e 'tell application "Microsoft Database Daemon" to quit'
rm -R '/Applications/Microsoft Communicator.app/'
rm -R '/Applications/Microsoft Messenger.app/'
rm -R '/Applications/Microsoft Office 2011/'
rm -R '/Applications/Remote Desktop Connection.app/'
rm -R '/Library/Application Support/Microsoft/'
rm -R /Library/Automator/*Excel*
rm -R /Library/Automator/*Office*
rm -R /Library/Automator/*Outlook*
rm -R /Library/Automator/*PowerPoint*
rm -R /Library/Automator/*Word*
rm -R '/Library/Automator/Add New Sheet to Workbooks.action'
rm -R '/Library/Automator/Create List from Data in Workbook.action'
rm -R '/Library/Automator/Create Table from Data in Workbook.action'
rm -R '/Library/Automator/Get Parent Presentations of Slides.action'
rm -R '/Library/Automator/Get Parent Workbooks.action'
rm -R '/Library/Automator/Set Document Settings.action'
rm -R '/Library/Fonts/Microsoft/'
rm -R /Library/Internet\ Plug-Ins/*SharePoint*
rm -R /Library/LaunchDaemons/*microsoft*
rm -R /Library/Preferences/*microsoft*
rm -R /Library/PrivilegedHelperTools/*microsoft*
OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.office*)
for ARECEIPT in $OFFICERECEIPTS
do
pkgutil --forget $ARECEIPT
done
@thejoecarroll
Copy link

What OS version(s) have you tested this on and against which version(s)/Service Pack(s) of Office 2011?

@piztol
Copy link

piztol commented Nov 7, 2013

Here is my version, tested on Office2011 v14.3.8. thanks.

!/bin/sh

make sure the script run by root

[ whoami = root ] || exec sudo -u root $0
echo

echo
echo '===================================='
echo ' Office 2011 un-installation script'
echo '===================================='
echo
echo 'This will fully remove Office 2011 from this computer.'
read -p "Do you want to proceed? [y/n]" -n 1 -r
echo # (optional) move to a new line
if [[ ! R E P L Y =   [ Y y ] ]]
then
exit 1
fi

echo
echo 'Closing all Office 2011 applications...'
echo
osascript -e 'tell application "Remote Desktop Connection" to quit'
osascript -e 'tell application "Microsoft Document Connection" to quit'
osascript -e 'tell application "Microsoft Messenger" to quit'
osascript -e 'tell application "Microsoft Communicator" to quit'
osascript -e 'tell application "Microsoft Outlook" to quit'
osascript -e 'tell application "Microsoft Excel" to quit'
osascript -e 'tell application "Microsoft PowerPoint" to quit'
osascript -e 'tell application "Microsoft Word" to quit'
osascript -e 'tell application "Microsoft Office Reminders" to quit'
osascript -e 'tell application "Microsoft AU Daemon" to quit'
osascript -e 'tell application "Microsoft Database Daemon" to quit'

echo 'Moving Office 2011 License file to your desktop...'
echo
mv -f /Library/Preferences/com.microsoft.office.licensing.plist $HOME/Desktop/ > /dev/null 2>&1

echo 'Moving Office 2011 User data to your desktop...'
echo
mv -f $HOME'/Documents/Microsoft User Data/' $HOME/Desktop/ > /dev/null 2>&1

echo 'Removing system files...'
echo
rm -fr /Applications/Microsoft\ Communicator.app/
rm -fr /Applications/Microsoft\ Messenger.app/
rm -fr /Applications/Microsoft\ Office\ 2011/
rm -fr /Applications/Remote\ Desktop\ Connection.app/
rm -fr /Library/Preferences/com.microsoft*
rm -fr /Library/Preferences/Microsoft/
rm -fr /Library/Application\ Support/Microsoft/
rm -fr /Library/LaunchDaemons/com.microsoft.office.*
rm -fr /Library/PrivilegedHelperTools/com.microsoft.office.*
rm -fr /Library/Receipts/Office2011_*
rm -fr /Library/Fonts/Microsoft/
rm -fr /Library/Internet\ Plug-Ins/SharePoint
rm -fr /Library/Automator/Excel
rm -fr /Library/Automator/Office
rm -fr /Library/Automator/Outlook
rm -fr /Library/Automator/PowerPoint
rm -fr /Library/Automator/Word
rm -fr /Library/Automator/Add\ New\ Sheet\ to\ Workbooks.action
rm -fr /Library/Automator/Create\ List\ from\ Data\ in\ Workbook.action
rm -fr /Library/Automator/Create\ Table\ from\ Data\ in\ Workbook.action
rm -fr /Library/Automator/Get\ Parent\ Presentations\ of\ Slides.action
rm -fr /Library/Automator/Get\ Parent\ Workbooks.action
rm -fr /Library/Automator/Set\ Document\ Settings.actionn

echo 'Removing user preferences files...'
echo
cd $HOME/Library/
rm -fr Preferences/com.microsoft*
rm -fr Preferences/Microsoft/
rm -fr Application\ Support/Microsoft/Office

echo 'Removing pakages...'
echo
OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.office*)
for ARECEIPT in $OFFICERECEIPTS
do
pkgutil --forget $ARECEIPT
done

rm -fr /private/var/db/receipts/com.microsoft.office*

echo '============='
echo ' All done...'
echo '============='
echo
echo 'Office App dock icons should be removed manually.'
echo
echo '"Microsoft User Data" was moved to your desktop, you can delete it later if your are not using it anymore.'
echo
echo 'After you re-install Office 2011, Copy "com.microsoft.office.licensing.plist" from your desktop back to "/Library/Preferences/", so you need not to activate again.'
echo

@Dials-Mavis
Copy link

^ piztol needs to learn how github works

Copy link

ghost commented Dec 1, 2015

LOL...nice script, but might want to add error handling/logging. At least "exit 0". :) Kudos for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment