22

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 ?

0

4 Answers 4

32

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:

  1. Open the Terminal.app (Found in /Applications/Utilities).
  2. Type cd and drag the folder which contains the file you want to delete, to the terminal window.
  3. Type rm -P FileName.extension and hit Enter
2
  • 9
    Or 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
  • 6
    in 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.
    – ccpizza
    May 28, 2022 at 21:41
17

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.

3
  • 1
    In fact, choosing "Secure Empty Trash" in Finder invokes srm.
    – lupincho
    Jul 29, 2012 at 16:23
  • @lupincho How do you choose that? I’ve never seen it before Jun 21, 2021 at 23:09
  • 2
    @unbeatable101: it is no longer available in recent versions of MacOS
    – lupincho
    Aug 19, 2021 at 13:58
5

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.)

-3

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.

3
  • 1
    Does rm securely delete files as the OP asks?
    – mmmmmm
    Jun 21, 2021 at 9:42
  • 3
    -P is already mentioned in the accepted answer. Nowadays, as apple.stackexchange.com/a/422756/9058 explains, neither srm nor rm -P will ensure that data actually gets overwritten.
    – nohillside
    Jun 21, 2021 at 9:46
  • And that is the reason to vote me down now?
    – womenlover
    Jun 22, 2021 at 6:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .