forked from kris-anderson/remove-zoom-macos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_zoom_macos.sh
executable file
·217 lines (165 loc) · 5.23 KB
/
remove_zoom_macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/usr/bin/env bash
######################
### make it pretty ###
######################
if [ "$TERM" == "dumb" ]; then
COL_RESET=""
COL_GREEN=""
COL_YELLOW=""
COL_RED=""
BOLD=""
NORMAL=""
else
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_RED=$ESC_SEQ"31;01m"
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
fi
###############
### helpers ###
###############
function not_found() {
echo -e "${COL_GREEN}[not found]${COL_RESET} " #$1
}
function deleted() {
echo -e "${COL_YELLOW}[deleted]${COL_RESET} " #$1
}
function terminated() {
echo -e "${COL_RED}[terminated]${COL_RESET} " #$1
}
loggedInUser=$(stat -f "%Su" /dev/console)
###################
### remove zoom ###
###################
# prompt the user for their password if required
echo ""
echo -e "${BOLD}Please Note:${NORMAL} This script will prompt for your password if you are not already running as sudo."
sudo -v
# kill the Zoom process if it's running
echo ""
echo -e "${BOLD}Checking to see if the Zoom process is running...${NORMAL}"
if pgrep -i zoom >/dev/null; then
sudo kill "$(pgrep -i zoom)"
printf "Zoom process "
terminated
else
printf "Zoom process "
not_found
fi
# remove the Zoom application
echo ""
echo -e "${BOLD}Removing the Zoom Application...${NORMAL}"
declare -a ZOOM_APPLICATION=(
"/Applications/zoom.us.app"
"/Users/$loggedInUser/Applications/zoom.us.app"
)
for ENTRY in "${ZOOM_APPLICATION[@]}"; do
if [ -f "${ENTRY}" ] || [ -d "${ENTRY}" ]; then
sudo rm -rf "${ENTRY}"
printf "%s " "${ENTRY}"
deleted
else
printf "%s " "${ENTRY}"
not_found
fi
done
# unload the Zoom Audio Device and remove the kext file
echo ""
echo -e "${BOLD}Removing the Zoom Audio Device...${NORMAL}"
if [ -f "/System/Library/Extensions/ZoomAudioDevice.kext" ] || [ -d "/System/Library/Extensions/ZoomAudioDevice.kext" ]; then
sudo kextunload -b zoom.us.ZoomAudioDevice
sudo rm -rf "/System/Library/Extensions/ZoomAudioDevice.kext"
printf "/System/Library/Extensions/ZoomAudioDevice.kext file "
deleted
else
printf "/System/Library/Extensions/ZoomAudioDevice.kext file "
not_found
fi
declare -a ZOOM_AUDIO_DEVICE=(
"/Library/Audio/Plug-Ins/HAL/ZoomAudioDevice.driver"
)
for ENTRY in "${ZOOM_AUDIO_DEVICE[@]}"; do
if [ -f "${ENTRY}" ] || [ -d "${ENTRY}" ]; then
sudo rm -rf "${ENTRY}"
printf "%s " "${ENTRY}"
deleted
else
printf "%s " "${ENTRY}"
not_found
fi
done
# remove the Zoom Plugin
echo ""
echo -e "${BOLD}Removing Zoom Plugins...${NORMAL}"
declare -a ZOOM_PLUGIN=(
"/Library/Internet Plug-Ins/ZoomUsPlugIn.plugin"
"/Users/$loggedInUser/Library/Internet Plug-Ins/ZoomUsPlugIn.plugin"
)
for ENTRY in "${ZOOM_PLUGIN[@]}"; do
if [ -f "${ENTRY}" ] || [ -d "${ENTRY}" ]; then
sudo rm -rf "${ENTRY}"
printf "%s " "${ENTRY}"
deleted
else
printf "%s " "${ENTRY}"
not_found
fi
done
# remove Zoom defaults
echo ""
echo -e "${BOLD}Removing Zoom defaults preferences...${NORMAL}"
if ! sudo defaults read us.zoom.xos 2>&1 | grep -Eq "Domain us.zoom.xos does not exist"; then
sudo defaults delete us.zoom.xos
printf "sudo defaults read us.zoom.xos "
deleted
else
printf "sudo defaults read us.zoom.xos "
not_found
fi
echo ""
echo -e "${BOLD}Removing pkgutil history...${NORMAL}"
if pkgutil --pkgs | grep -Eq "us.zoom.pkg.videmeeting"; then
sudo pkgutil --forget us.zoom.pkg.videmeeting &> /dev/null
printf "pkgutil history for us.zoom.pkg.videmeeting "
deleted
else
printf "pkgutil history for us.zoom.pkg.videmeeting "
not_found
fi
# remove extra Zoom cruft
echo ""
echo -e "${BOLD}Removing extra cruft that Zoom leaves behind...${NORMAL}"
declare -a ZOOM_CRUFT=(
"/Users/$loggedInUser/.zoomus"
"/Users/$loggedInUser/Library/Application Support/zoom.us"
"/Library/Caches/us.zoom.xos"
"/Users/$loggedInUser/Library/Caches/us.zoom.xos"
"/Library/Logs/zoom.us"
"/Users/$loggedInUser/Library/Logs/zoom.us"
"/Library/Logs/zoominstall.log"
"/Users/$loggedInUser/Library/Logs/zoominstall.log"
"/Library/Preferences/ZoomChat.plist"
"/Users/$loggedInUser/Library/Preferences/ZoomChat.plist"
"/Library/Preferences/us.zoom.xos.plist"
"/Users/$loggedInUser/Library/Preferences/us.zoom.xos.plist"
"/Users/$loggedInUser/Library/Saved Application State/us.zoom.xos.savedState"
"/Users/$loggedInUser/Library/Cookies/us.zoom.xos.binarycookies"
"/Users/$loggedInUser/Library/Preferences/us.zoom.xos.Hotkey.plist"
"/Users/$loggedInUser/Library/Preferences/us.zoom.airhost.plist"
"/Users/$loggedInUser/Library/Mobile Documents/iCloud~us~zoom~videomeetings"
"/Users/$loggedInUser/Library/Application Support/CloudDocs/session/containers/iCloud.us.zoom.videomeetings.plist"
"/Users/$loggedInUser/Library/Application Support/CloudDocs/session/containers/iCloud.us.zoom.videomeetings"
)
for ENTRY in "${ZOOM_CRUFT[@]}"; do
if [ -f "${ENTRY}" ] || [ -d "${ENTRY}" ]; then
sudo rm -rf "${ENTRY}"
printf "%s " "${ENTRY}"
deleted
else
printf "%s " "${ENTRY}"
not_found
fi
done