Category filter

Script to Delete User Account on Mac

When employees leave an organization, the corporate devices assigned to them are re-distributed to other workers in the firm. Hence, organizations may require to delete the data and user account from the devices. However, manually doing this task is a time-consuming process. Hexnode lets you deploy scripts to delete the user account from Mac devices.

Scripting Language – Bash

File extension – .sh


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Delete the user account

Delete directories and files of the user

The user account and all associated data will be erased from the device if both commands are executed successively.


  • Replace <username> with the username of account to be deleted.
  • You can eliminate spaces in the username when substituting it in the script.
  • 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