Completely delete teams on a Mac

1 minute read

If teams is acting up sometimes (read: almost always) the only way to stop it is by deleting it completely. Microsoft has an answer on Microsoft answers on how to do it, I put it into a script. Here it is.

This might not be absolutely everything though, cause it still remembered my account which I used last time.

#!/usr/bin/env bash

# source: microsoft

# $1 - full path to file / dir to delete
delete_teams_file() {
    if [[ -d $1 ]] ; then
        echo -n "DELETE      $DELETE_ME ... "
        rm -rf "$DELETE_ME"
        echo "done."
        echo "Not found - $DELETE_ME"

set -euo pipefail

# prepare sudo entry
echo "Prepare sudo ..."
sudo echo "sudo prep successful :)"

for DELETE_DIR in teams teams.shipit ; do
    delete_teams_file "${DELETE_BASE}${DELETE_DIR}"

DELETE_BASE="$HOME/Library/Application Support/Microsoft/Teams"
delete_teams_file "$DELETE_BASE"

sudo rm -rf "/Applications/Microsoft"

echo "All done."