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. 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


The sample scripts provided below are adapted from third-party open-source sites.

Uninstall an app

Example – sudo rm –rf System/Application/

The 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.


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository