board logo
sirclesadmin
7 months ago
Sponsor

Want to thank us? Use: Patreon or PayPal or Bitcoins: bc1q4whppe29dw77rm4kv4pln0gqae4yjnxly0dny0hky6yhnafukzjsyrsqhk

All opinions expressed within these pages are sent in by members of the public or by our staff in their spare time, and as such do not represent any opinion held by sircles.net Ltd or their partners.

sirclesadmin
7 months ago

Good question - Microsoft AutoUpdate (MAU) is notoriously persistent on macOS. Even if you delete Office or Teams, MAU often remains behind and keeps relaunching or running background updates.
Let's take it apart methodically.




Step 1: Quit all Microsoft processes


First, make sure no Microsoft background daemons are running:


ps aux | grep Microsoft 

Then quit or kill any of these processes if you see them:



  • Microsoft AutoUpdate

  • MAU

  • Microsoft Update Assistant

  • com.microsoft.autoupdate.helper


Use:


killall "Microsoft AutoUpdate" 



Step 2: Remove the AutoUpdate app bundle


It's usually here:


sudo rm -rf /Library/Application\ Support/Microsoft/MAU2.0 

That folder holds the AutoUpdate binary and all its resources.


Also check and remove (if they exist):


sudo rm -rf /Library/Application\ Support/Microsoft/MAU 
sudo rm -rf /Library/Application\ Support/Microsoft/AutoUpdate



Step 3: Delete the LaunchAgents and LaunchDaemons


This is what actually makes MAU respawn. Remove all these if present:


sudo rm -f /Library/LaunchAgents/com.microsoft.update.agent.plist 
sudo rm -f /Library/LaunchDaemons/com.microsoft.autoupdate.helper.plist
sudo rm -f ~/Library/LaunchAgents/com.microsoft.update.agent.plist

Then unload any that are still active:


launchctl bootout system /Library/LaunchDaemons/com.microsoft.autoupdate.helper.plist 
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.microsoft.update.agent.plist



Step 4: Remove user-level cache and preferences


These prevent MAU from reinstalling itself via background calls:


rm -rf ~/Library/Application\ Support/Microsoft/MAU* 
rm -rf ~/Library/Caches/com.microsoft.autoupdate*
rm -rf ~/Library/Preferences/com.microsoft.autoupdate*.plist



Step 5: Prevent reinstallation


If you still use Word, Excel, Outlook, etc., they will reinstall MAU when launched.
You have two options:


Option A - Disable updates but keep MAU


Open Terminal:


defaults write com.microsoft.autoupdate2 HowToCheck -string "Manual" 

Option B - Block its network access


Add this line to /etc/hosts to block the update domain:


127.0.0.1 officecdn.microsoft.com 
127.0.0.1 officecdn.microsoft.com.edgesuite.net

That prevents MAU from calling home.




Step 6: Reboot


Reboot to flush launchd caches. After restart, confirm it's gone:


launchctl list | grep microsoft 

If nothing returns, you've successfully exorcised it.




Love it. Here's a single, reusable cleanup script that removes Microsoft AutoUpdate (MAU) from macOS with safety checks, backups, and clear logging. It supports --dry-run (default), --execute, and optional --block-hosts to stop MAU coming back via Office apps.



TL;DR: copy this to a file, run with --execute when you're happy with the plan.





1) Save the script


Create a file called mau-clean.sh and paste this in:


#!/usr/bin/env bash 
set -euo pipefail
# Microsoft AutoUpdate (MAU) remover for macOS
# Modes:
# --dry-run (default) print what would be done
# --execute perform removals
# --block-hosts also add hosts-file entries to block MAU CDNs
# # Safe: backs up plists & helpers before deletion, logs everything.
# Restore: remove the backup folder (no system changes to revert except hosts).
DRY_RUN=1
BLOCK_HOSTS=0
for arg in "$@"; do
case "$arg" in
--execute) DRY_RUN=0 ;;
--dry-run) DRY_RUN=1 ;;
--block-hosts) BLOCK_HOSTS=1 ;;
😉 echo "Unknown option: $arg" >&2; exit 2 ;;
esac
done
timestamp() { date +"%Y-%m-%d_%H-%M-%S"; }
TS="$(timestamp)"
LOG="${HOME}/mau_cleanup_${TS}.log"
BACKUP_DIR="${HOME}/mau_backup_${TS}"
log() { echo "[$(timestamp)] $*" | tee -a "$LOG"; }
need_sudo() {
if [[ $DRY_RUN -eq 1 ]]; then return 0; fi
if [[ $(id -u) -ne 0 ]]; then
log "Elevating with sudo..."
sudo -v
fi
}
do_cmd() {
if [[ $DRY_RUN -eq 1 ]]; then
log "DRY-RUN: $*"
else
log "RUN: $*"
eval "$@" 2>&1 | tee -a "$LOG"
fi
}
backup_file() {
local p="$1"
[[ -e "$p" ]] || return 0
do_cmd "mkdir -p \"$BACKUP_DIR\""
do_cmd "cp -pR \"$p\" \"$BACKUP_DIR/\""
}
remove_path() {
local p="$1"
if [[ -e "$p" ]]; then
backup_file "$p"
do_cmd "$( (( $(id -u) == 0 )) && echo "" || echo "sudo " )rm -rf \"$p\""
fi
}
unload_plist() {
local scope="$1" # system|gui
local plist="$2"
if [[ -e "$plist" ]]; then
if [[ "$scope" == "system" ]]; then
do_cmd "launchctl bootout system \"$plist\" || true"
else
do_cmd "launchctl bootout gui/$(id -u) \"$plist\" || true"
fi
fi
}
# -------- Start ----------
log "Microsoft AutoUpdate Cleanup started"
log "Log file: $LOG"
log "Backup dir: $BACKUP_DIR"
if [[ $DRY_RUN -eq 1 ]]; then
log "Mode: DRY-RUN (no changes will be made)"
else
log "Mode: EXECUTE (changes will be made)"
fi
# 0) Elevation if needed
need_sudo
# 1) Kill running MAU processes
log "Step 1: Stopping MAU processes"
for p in \
"Microsoft AutoUpdate" \
"MAU" \
"Microsoft Update Assistant" \
"com.microsoft.autoupdate.helper"
do
do_cmd "pkill -f \"$p\" || true"
done
# 2) Unload launch agents/daemons
log "Step 2: Unloading LaunchAgents/LaunchDaemons"
SYS_DAEMONS=(
"/Library/LaunchDaemons/com.microsoft.autoupdate.helper.plist"
) SYS_AGENTS=(
"/Library/LaunchAgents/com.microsoft.update.agent.plist"
) USER_AGENTS=(
"$HOME/Library/LaunchAgents/com.microsoft.update.agent.plist"
)
for pl in "${SYS_DAEMONS[@]}"; do unload_plist "system" "$pl"; done
for pl in "${SYS_AGENTS[@]}"; do unload_plist "system" "$pl"; done
for pl in "${USER_AGENTS[@]}"; do unload_plist "gui" "$pl"; done
# 3) Remove helper tools, app bundle and support dirs
log "Step 3: Removing helper tools and app bundles"
SUPPORT_DIRS=(
"/Library/Application Support/Microsoft/MAU2.0"
"/Library/Application Support/Microsoft/MAU"
"/Library/Application Support/Microsoft/AutoUpdate"
) HELPERS=(
"/Library/PrivilegedHelperTools/com.microsoft.autoupdate.helper"
) PLISTS=(
"/Library/LaunchDaemons/com.microsoft.autoupdate.helper.plist"
"/Library/LaunchAgents/com.microsoft.update.agent.plist"
"$HOME/Library/LaunchAgents/com.microsoft.update.agent.plist"
)
for p in "${HELPERS[@]}"; do remove_path "$p"; done
for p in "${SUPPORT_DIRS[@]}"; do remove_path "$p"; done
for p in "${PLISTS[@]}"; do remove_path "$p"; done
# 4) User caches & preferences
log "Step 4: Removing user caches & preferences"
USER_STUFF=(
"$HOME/Library/Application Support/Microsoft/MAU"
"$HOME/Library/Application Support/Microsoft/MAU2.0"
"$HOME/Library/Caches/com.microsoft.autoupdate.fba"
"$HOME/Library/Caches/com.microsoft.autoupdate2"
"$HOME/Library/Preferences/com.microsoft.autoupdate2.plist"
"$HOME/Library/Preferences/com.microsoft.autoupdate.helper.plist"
) for p in "${USER_STUFF[@]}"; do remove_path "$p"; done
# 5) pkg receipts (so macOS doesn't think MAU is installed)
log "Step 5: Forgetting installer receipts (if present)"
PKGS=$(pkgutil --pkgs | grep -i "com\.microsoft\.autoupdate" || true)
if [[ -n "$PKGS" ]]; then
while IFS= read -r pkg; do
[[ -z "$pkg" ]] && continue
do_cmd "$( (( $(id -u) == 0 )) && echo "" || echo "sudo " )pkgutil --forget \"$pkg\""
done <<< "$PKGS"
else
log "No MAU-related receipts found."
fi
# 6) Optional: block hosts
if [[ $BLOCK_HOSTS -eq 1 ]]; then
log "Step 6: Blocking MAU/CDN endpoints in /etc/hosts"
HOSTS_LINES=(
"127.0.0.1 officecdn.microsoft.com"
"127.0.0.1 officecdn.microsoft.com.edgesuite.net"
)
for line in "${HOSTS_LINES[@]}"; do
if ! grep -qF "$line" /etc/hosts; then
do_cmd "sudo /bin/sh -c 'echo \"$line\" >> /etc/hosts'"
else
log "Hosts already contains: $line"
fi
done
else
log "Skipping hosts blocking (use --block-hosts to enable)."
fi
# 7) Final checks
log "Step 7: Verifying"
do_cmd "launchctl list | grep -i microsoft || true"
do_cmd "pgrep -afil Microsoft || true"
log "Done. If any processes or plists still appear above, reboot to flush launchd."
log "Backups stored at: $BACKUP_DIR"

Make it executable:


chmod +x mau-clean.sh 



2) Dry-run first (highly recommended)


This prints the full plan and what will be removed, without touching your system:


./mau-clean.sh 

Skim the log it prints (also saved to ~/mau_cleanup_*.log).




3) Execute for real


When you're satisfied:


sudo ./mau-clean.sh --execute 

Optional: also block MAU's CDN endpoints to stop silent re-installs via Office:


sudo ./mau-clean.sh --execute --block-hosts 



4) Aftercare



  • Reboot once to flush any cached launchd state.



  • Verify:


    launchctl list | grep -i microsoft || echo "No Microsoft launch items found." 
    pgrep -afil Microsoft || echo "No Microsoft processes found."


  • If you still use Office apps: they may try to reinstall MAU. Consider leaving updates set to manual:


    defaults write com.microsoft.autoupdate2 HowToCheck -string "Manual" 





You can tailor this to only disable MAU (not remove files) for managed Macs, or wire it into a Jamf/Intune remediation script with exit codes.