My Question is I want to erase a file in OS X Securely (like the function of "Secure Empty Trash") so that, the file cannot be recovered by using recovery tools. I don't want to empty the trash. It is possible to erase Files Securely in OS X without moving the file to Trash ?
4 Answers
You can always use the terminal command rm
with the -P
option:
[Option -P will] Overwrite regular files before deleting them. Files are overwritten three times, first with the byte pattern 0xff, then 0x00, and then 0xff again, before they are deleted.
If you're not handy with the Terminal, just:
- Open the Terminal.app (Found in /Applications/Utilities).
- Type
cd
and drag the folder which contains the file you want to delete, to the terminal window. - Type
rm -P FileName.extension
and hit Enter
-
9Or combine step 2 and 3 by typing
rm -P
followed by directly dragging the file into the terminal window. It's also worth mentioning that depending on the sector/cluster allocation process it is usually not guaranteed that the whole file will be overwritten. If you really care about these things use FileVault 2 to encrypt the whole drive.– nohillside ♦Jul 27, 2012 at 13:59 -
6in more recent versions of macos (eg monterey)
-P
doesn't do anything; according to the man page-P This flag has no effect. It is kept only for backwards compatibility with 4.4BSD-Lite2.
– ccpizzaMay 28, 2022 at 21:41
srm
is another shell utility for deleting files securely. It uses the 35-pass Gutmann algorithm by default, but -s
(overwriting files with random data once) is faster and should be secure enough for most purposes.
-
1
-
-
2@unbeatable101: it is no longer available in recent versions of MacOS– lupinchoAug 19, 2021 at 13:58
If you want to make sure that your files, deleted or otherwise, cannot be recovered, just turn on FileVault to encrypt your disk.
Multiple erases or writes on SSDs do not make the file "more" erased.
(I realise this is an old question.)
The securely delete
command overwritten the areas on the storage medium. In OS X El Capitan 10.11
it was still accessible via the terminal. It was called srm
- and has disappeared since macOS Sierra 10.12
The -P
option ensures that when deleting the memory areas are overwritten three times before the memory space is released. For example, rm -P Desktop/File.txt
deletes the file File.txt
from the desktop. The additional option -R
also removes folder contents and subfolders (as well as their contents)
rm -RP ~/Desktop/[Directory/File]
Deletes folders and their contents. To avoid typing errors, enter rm -RP
including a space at the end.
-
1
-
3
-P
is already mentioned in the accepted answer. Nowadays, as apple.stackexchange.com/a/422756/9058 explains, neithersrm
norrm -P
will ensure that data actually gets overwritten.– nohillside ♦Jun 21, 2021 at 9:46 -