Script to uninstall apps on Mac
On Mac, users can delete apps by navigating to the ‘Applications’ folder and selecting Move to Trash from the context menu. However, this method might leave behind some app files which can take up unwanted space on the system. Run the script below on the Mac Terminal application to remove all associated app files while removing the app from the system.
Device admins can remotely run scripts on Macs managed with Hexnode using the Execute Custom Script action.
Scripting language – Bash
File extension – .sh
Uninstall an app
sudo rm -rf “/path to the app files”
sudo rm –rf System/Application/XCode.app
rm command removes the directory entries on a Mac. Some of the options supported with the command in this respect are –
-r : Removes the file hierarchy.
-f : Removes the files without prompting for confirmation.
This command can be used to remove applications on Mac as applications are also a form of file.