-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
85 lines (73 loc) · 1.95 KB
/
uninstall.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
#!/bin/bash
# Function to display messages
function echo_msg {
echo -e "\033[1;31m$1\033[0m"
}
# Check if the script is running as root
if [[ "$EUID" -eq 0 ]]; then
echo "Please do not run this script as root!"
exit 1
fi
# Uninstall Docker
if brew list --cask | grep -q "^docker\$"; then
echo_msg "Uninstalling Docker..."
brew uninstall --cask docker
else
echo_msg "Docker is not installed."
fi
# Uninstall pnpm
if command -v pnpm &>/dev/null; then
echo_msg "Uninstalling pnpm..."
npm uninstall -g pnpm
else
echo_msg "pnpm is not installed."
fi
# Uninstall Bun
if command -v bun &>/dev/null; then
echo_msg "Uninstalling Bun..."
rm -rf ~/.bun
else
echo_msg "Bun is not installed."
fi
# Uninstall Deno
if brew list | grep -q "^deno\$"; then
echo_msg "Uninstalling Deno..."
brew uninstall deno
else
echo_msg "Deno is not installed."
fi
# Uninstall Node.js and nvm
if [ -d "$HOME/.nvm" ]; then
echo_msg "Uninstalling nvm and Node.js..."
rm -rf "$HOME/.nvm"
sed -i '' '/export NVM_DIR/d' ~/.bashrc ~/.zshrc
sed -i '' '/\[ -s "\$NVM_DIR\/nvm.sh" \]/d' ~/.bashrc ~/.zshrc
else
echo_msg "nvm is not installed."
fi
# Uninstall VSCode
if brew list --cask | grep -q "^visual-studio-code\$"; then
echo_msg "Uninstalling Visual Studio Code..."
brew uninstall --cask visual-studio-code
else
echo_msg "Visual Studio Code is not installed."
fi
# Uninstall Git
if brew list | grep -q "^git\$"; then
echo_msg "Uninstalling Git..."
brew uninstall git
else
echo_msg "Git is not installed."
fi
# Uninstall Homebrew
if command -v brew &>/dev/null; then
echo_msg "Uninstalling Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
else
echo_msg "Homebrew is not installed."
fi
# Cleanup
echo_msg "Removing leftover configuration files..."
rm -rf ~/.bashrc ~/.zshrc ~/.npm ~/.pnpm ~/.config/pnpm
# Final Message
echo_msg "Uninstallation complete. Your system is reverted to its original state."