Last active
July 31, 2023 12:19
-
-
Save saintdle/028c76dddf908f9c44e0dcbf4bf82507 to your computer and use it in GitHub Desktop.
VMware Fusion Cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to force kill VMware Fusion if it is running | |
force_kill_vmware_fusion() { | |
if pgrep "VMware Fusion" > /dev/null; then | |
echo "Force killing VMware Fusion..." | |
sudo pkill -9 "VMware Fusion" | |
fi | |
} | |
# Function to uninstall VMware Fusion | |
uninstall_vmware_fusion() { | |
# Move VMware Fusion to Trash | |
sudo mv "/Applications/VMware Fusion.app" ~/.Trash/ | |
# Empty the Trash | |
sudo rm -rf ~/.Trash/VMware\ Fusion.app | |
} | |
# Function to check if a file exists and delete it | |
delete_file() { | |
if [ -e "$1" ]; then | |
echo "Deleting: $1" | |
sudo rm -rf "$1" | |
fi | |
} | |
# Force kill VMware Fusion if running | |
force_kill_vmware_fusion | |
# Define the list of files and directories to be deleted | |
files_to_delete=( | |
"/Library/Application Support/VMware/VMware Fusion" | |
"/Library/Application Support/VMware/Usbarb.rules" | |
"/Library/Preferences/VMware Fusion" | |
"$HOME/Library/Application Support/VMware Fusion" | |
"$HOME/Library/Caches/com.vmware.fusion" | |
"$HOME/Library/Preferences/VMware Fusion" | |
"$HOME/Library/Preferences/com.vmware.fusion.LSSharedFileList.plist" | |
"$HOME/Library/Preferences/com.vmware.fusion.LSSharedFileList.plist.lockfile" | |
"$HOME/Library/Preferences/com.vmware.fusion.plist" | |
"$HOME/Library/Preferences/com.vmware.fusion.plist.lockfile" | |
"$HOME/Library/Preferences/com.vmware.fusionDaemon.plist" | |
"$HOME/Library/Preferences/com.vmware.fusionDaemon.plist.lockfile" | |
"$HOME/Library/Preferences/com.vmware.fusionStartMenu.plist" | |
"$HOME/Library/Preferences/com.vmware.fusionStartMenu.plist.lockfile" | |
) | |
# Uninstall VMware Fusion | |
uninstall_vmware_fusion | |
# Loop through the list of files and delete them if found | |
for file_path in "${files_to_delete[@]}"; do | |
delete_file "$file_path" | |
done | |
echo "Cleanup and Uninstallation completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment