Category filter
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. But 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
1 2 |
#!/bin/bash sudo rm -rf “/path to the app files” |
Example – sudo rm –rf System/Application/XCode.app
The rm
command removes the directory entries on a Mac system. Somes of the options supported with the command in this respect are –
-r
– Removes the file hierarchy.-f
– Removes the files without prompting for confirmation.
We can use this command to remove applications on Mac as applications are also a form of file.