Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to securely erase some files. I have used shred on linux systems before, so I looked around and found that shred is part of the coreutils package in macports. I did port install coreutils to install coreutils, but I still can't find shred in the command line.

How can I get shred to work on my mac's command line? If it matters, I'm using Mac OS X 10.7.5 (Lion)

share|improve this question
Note the security of shred depends on the filesystem being used, I don't know how effective it is on HFS. – Flimm Jul 9 '15 at 9:06
up vote 10 down vote accepted

port install coreutils adds a g prefix to the names of binaries, so shred is /opt/local/bin/gshred.

share|improve this answer

OSX has a built in command srm to securely remove files. See You can also use rm -P to overwrite the files with sequences of bytes three times.

share|improve this answer
Sure, but shred lets me set the number of overwrites. These tools don't. Any ideas on how to get that functionality? – inspectorG4dget Jul 9 '13 at 15:37
You can use the -m option for seven overwrites or -s for only one, but I don't think you can specify a specific number. – Tobi Hahn Jul 9 '13 at 15:40
+1 Excellent answer. I didn't know the srm command existed. It overwrites, renames and truncates the file before deleting it. That, plus the 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random) (-m option) guarantee the file is irrecoverable. – Tulains Córdova Sep 23 '14 at 0:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.