I've just updated to macOS 10.12 and when I try to execute
srm in Terminal, it says
-bash: srm: command not found.
srm removed? How to fix this?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Not yet running macOS 10.12 however under OS X 10.8.5 the man page for
srm in the
NOTES section states:
Now you'd have to download the source code and compile it for yourself. This would require Command Line Tools for Xcode be installed. Not sure if still applicable under macOS 10.12 however, see How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode) for details. Or in Terminal use the following command:
I downloaded the latest source code and it compiled without errors under OS X 10.8.5, although that doesn't mean it will under macOS 10.12 but it's probably the only choice you've got if
srm has been removed.
That said, I probably would only
srm on rotational HDD's not SSD's.
From this comment:
can you come up with a better idea or safely removing files from SSD on newer macs? – Niktin Roman
There's no need for
srm; provided that TRIM is enabled on your machine1
TRIM support handles this for you. When you delete a file from your drive, the OS will mark the file space as "not in use" - this applies to any drive. On an SSD, unlike a HDD, a TRIM command is sent to wipe any data in that marked space. This allows your SSD to be able to write data to that marked space as if it was brand new and never used, and skip the traditional deletion process.
If you are looking for more security, turn on FileVault.
Per Apple Support:
Note: With an SSD drive, Secure Erase and Erasing Free Space are not available in Disk Utility. These options are not needed for an SSD drive because a standard erase makes it difficult to recover data from an SSD. For more security, consider turning on FileVault encryption when you start using your SSD drive.
I also advise against using
srm because it issues more and unnecessary write operations to the SSD, thus shortening it's lifespan. From the man page:
srm removes each specified file by overwriting, renaming, and truncating it before unlinking
sudo trimforce enablein Terminal.
rm has a -P switch that will overwrite the file three times before deleting. Better than nothing, I suppose.
To securely delete a file/folder on MacOS Sierra without external utilities use
rm with the
## delete a single file rm -Pv wikileak1.txt ## delete a folder recursively rm -Pvrf ~/.wikileaks
From the man page:
-P 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. -v increase verbosity
NOTE: In case you installed GNU coreutils from homebrew with the default names, e.g.
brew install coreutils --default-names, then, depending on how you configured your PATH, the GNU version of
rmcould shadow the Mac version at
/bin/rmand it won't accept the
which -a rmto double-check.
Since this question was originally answered two things have happened:
homebrew-dupeswas merged into
srmwas deleted from
If you try to install it now it will give you details of the deleting commit and a suggestion to create your own tap if you still need it. I have done so here.
You can install it using Homebrew:
brew install khell/homebrew-srm/srm
There are plenty of good reasons not to use secure deletion tools (
rm -P, etc) on modern systems (with TRIM-enabled SSDs and/or journalled file systems). @Allan's answer in particular is spot on.
brew install khell/homebrew-srm/srm srm secrets.txt
(After you've installed Homebrew, obviously.)
sudo port install srm that will do
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.