You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I securely delete a file in MacOS Mojave? That is, delete the file and overwrite the space with random bits.

Using Disk Utility I can securely erase a hard disk with various levels of overwrite. How do I do the same thing at the file level? I seem to remember this being a delete option but can't find it in v10.14.6.

iMac 27″ 5K, macOS 10.14

Posted on Sep 12, 2021 1:09 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 12, 2021 2:04 PM

Above is correct, if you’re on SSD.


SSD storage does not work even remotely similarly to how HDD storage works, in terms of overwriting.


rm -P


…will overwrite files on HDD. SSDs do not support sector overwrite, and erase each sector as the file is deleted or the storage otherwise released.


Here’s an older thread which explains more of what happened, and why: secure empty trash in Mojave - Apple Community


I didn’t see a man page for srm on Big Sur, but didn’t poke further than that.


And if you’re concerned about security, all of your volumes should be encrypted. That might well include creating and using an encrypted virtual volume (sparse bundle image) that you’ve created for whatever you’re working on here.



3 replies
Question marked as Top-ranking reply

Sep 12, 2021 2:04 PM in response to NewToSnowLeopard

Above is correct, if you’re on SSD.


SSD storage does not work even remotely similarly to how HDD storage works, in terms of overwriting.


rm -P


…will overwrite files on HDD. SSDs do not support sector overwrite, and erase each sector as the file is deleted or the storage otherwise released.


Here’s an older thread which explains more of what happened, and why: secure empty trash in Mojave - Apple Community


I didn’t see a man page for srm on Big Sur, but didn’t poke further than that.


And if you’re concerned about security, all of your volumes should be encrypted. That might well include creating and using an encrypted virtual volume (sparse bundle image) that you’ve created for whatever you’re working on here.



Sep 12, 2021 1:16 PM in response to NewToSnowLeopard

If the file lives/lived on an ssd, there is no need to do secure overwrite. The nature of ssd storage makes that unnecessary.

If the file is/was on an hdd, I don't believe macOS has a utility for that other than when formatting a drive, as you posted.

Terminal, maybe, has commands available for the task.

You might have to rely on a third party app to do this.

Sep 12, 2021 1:44 PM in response to NewToSnowLeopard

Drag it to the Trash and empty the Trash. Forget about it. Once the file is deleted, it is on a fast track to the available storage pool and no one with recovery tools will have time to recover and review the file.


As none of us are on the macOS product development team, we could only speculate what is really going on once the operating system detects that a file has been deleted and is marked dirty for available space reclamation. It might do everything to automatically put your security concerns to rest…


If security remains a deep concern, then enable FileVault 2 and secure the entire drive.

How do I securely delete a file in MacOS Mojave? That is, delete the file and overwrite the space with random bits.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.