#!/bin/sh read -p "This will uninstall Office 2011 and automatically restart your Mac. / The Trash will be empied too. Are you sure? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] then homedir=~ echo Closing any open Office applications... osascript -e 'tell application "Microsoft Lync" to quit' osascript -e 'tell application "Microsoft Outlook" to quit' osascript -e 'tell application "Microsoft Messenger" to quit' osascript -e 'tell application "Microsoft Messenger Daemon" to quit' osascript -e 'tell application "Microsoft PowerPoint" to quit' osascript -e 'tell application "Microsoft Word" to quit' osascript -e 'tell application "Microsoft Excel" to quit' osascript -e 'tell application "Microsoft Database Daemon" to quit' osascript -e 'tell application "Microsoft AU Daemon" to quit' osascript -e 'tell application "Office365Service" to quit' echo Deleting apps... rm -R '/Applications/Microsoft Communicator.app/' rm -R '/Applications/Microsoft Lync.app/' rm -R '/Applications/Microsoft Messenger.app/' rm -R '/Applications/Microsoft Office 2011/' rm -R '/Applications/Remote Desktop Connection.app/' echo Remove Application Support folders... rm -R '/Library/Application Support/Microsoft' rm -R '/Library/Receipts/Office2011_*' rm -R "$homedir/Library/Application Support/Microsoft/Office" echo Archive user data... cp -r "$homedir/Documents/Microsoft User Data" "$homedir/Documents/Microsoft User Data Archive" rm -R "$homedir/Documents/Microsoft User Data" echo Remove any automator scripts... 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/*Workbook* rm -R '/Library/Automator/Get Parent Presentations of Slides.action' rm -R '/Library/Automator/Set Document Settings.action' echo Remove Microsoft fonts... rm -R /Library/Fonts/Microsoft echo Move Apple fonts back... mv '/Library/Fonts Disabled/Arial Bold Italic.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Arial Bold.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Arial Italic.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Arial.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Brush Script.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Times New Roman Bold Italic.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Times New Roman Bold.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Times New Roman Italic.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Times New Roman.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Verdana Bold Italic.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Verdana Bold.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Verdana Italic.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Verdana.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Wingdings 2.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Wingdings 3.ttf' /Library/Fonts mv '/Library/Fonts Disabled/Wingdings.ttf' /Library/Fonts echo Remove system wide Microsoft plist files... rm -R "/Library/Internet Plug-Ins/SharePoint*" rm -R /Library/LaunchDaemons/com.microsoft.* rm -R /Library/Preferences/com.microsoft.* rm -R /Library/PrivilegedHelperTools/com.microsoft.* echo Remove user Microsoft plist files... rm -R ~/Library/Preferences/com.microsoft.* rm -R ~/Library/Preferences/Microsoft* rm -R ~/Library/Preferences/ByHost/com.microsoft.* rm -R ~/Library/Preferences/ByHost/Microsoft* echo Clean out install package database... OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.office.*) for ARECEIPT in $OFFICERECEIPTS do pkgutil --forget $ARECEIPT done OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.lync.*) for ARECEIPT in $OFFICERECEIPTS do pkgutil --forget $ARECEIPT done echo Empty the trash... osascript -e 'tell application "Finder" to empty the trash' read -p "You must restart your Mac before installing Office 2016. Restart now? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] then shutdown -r now fi exit 0 fi