Remotely wipe Mac

  • 20 February 2024
  • 2 replies


Is there a way to remotely wipe Macs either through worklet or script using Automox? Essecially looking for something similar to a factory reset. I found a post for Windows but not Mac.


Thanks for the advice!

2 replies

Userlevel 5
Badge +1

I’d imagine this one will require the use of an MDM tool. I wouldn’t think that would be a scriptable thing with Mac, especially if it is already enrolled. 

Userlevel 1


# This will erase all data on your Mac and reinstall macOS

# Unmount disk
diskutil unmountDisk /dev/disk0

# Erase disk
diskutil eraseDisk JHFS+ "Macintosh HD" /dev/disk0

# Reinstall macOS
osascript -e 'tell application "Finder" to activate' -e 'tell application "System Events" to tell process "Finder" to keystroke "d" using {command down, shift down}'

# Inform user
echo "Factory reset complete. Your Mac will now restart and begin the macOS installation process."


this has not been tested.