External Hard Drive: Unable to Begin Erase Operation -69464 on Mac

I prepare to erase an external hard drive on my Mac.
The entire drive, not a volume on it.
Disk Utility is unresponsive when I click the Erase button.
Running diskutil eraseDisk in the Terminal, I get:
Unable to begin erase operation: This operation is restricted by Sandbox; check your settings in System Preferences > Security & Privacy > Privacy > Files and Folders (-69464)
What does it mean? How can I erase my external drive?

On macOS versions Big Sur and later, apps and even some built-in utilities like Terminal are sandboxed.

In other words, they don’t automatically get full access to your files or external devices unless you explicitly grant it.

The error (-69464) shows that the erase operation is blocked by the system’s privacy controls. macOS treated your attempt to erase the external drive as a request to access a “Files and Folders” location without permission.

You should grant Terminal Full Disk Access in System Preferences > Security & Privacy > Privacy > Files and Folders.

Then retry the command to erase your external hard drive.

The “Operation is not permitted” error in Mac Terminal is a sandbox restriction issue. The sandbox restrictions not only block third-party apps but also Terminal. Just enable Terminal in System Preferences > Security & Privacy > Privacy > Files and Folders. Then, everything goes well.

By the way, if you plan to erase your external hard drive because it is inaccessible. Be cautious that the erasure process will wipe all data on it. You’ll face permanent data loss.

If you need the data, use a data recovery tool, like iBoysoft Data Recovery for Mac, to rescue files from the inaccessible drive.

  1. Download iBoysoft Data Recovery for Mac, install it, and open it.
  2. Choose the drive, click Search for Lost Data, and wait for the process to complete.
  3. Preview the scanning results, choose the wanted data, and click Recover to save them to a different location.