Well, you might not know this, but once you delete any file from your Mac the usual way, the file actually remains there, only that it is no longer usable by your Mac. Then, when you add more files to your Mac, they ‘overwrite’ the space taken by those unusable files that you deleted previously. What this means is that an advanced user who might come into possession of your Mac can actually recover files that you have deleted previously. Unless, of course, you delete them securely first. For this, using the Terminal utility is perhaps the best way out, since it allows you much more control over what you are doing. Important Note: Always remember to use Terminal ONLY when you are confident in what you are doing, since a simple mistake when using this utility can cause some serious damage to your Mac. So let’s learn how to securely erase all that free space on your Mac’s hard drive with Terminal. First, here is the Terminal command we will be using. Just keep it there for now, since you will need to slightly change it before proceeding. diskutil secureErase freespace 1 /dev/disk0s2
This is because this command uses slightly different values for each Mac, so before using it on Terminal, you will have to find the exact values for your Mac first. – The first value to change is the number ‘1’. You can actually choose between ‘1’, ‘2’ and ‘3’ here. Using number ‘1’ erases your disk’s free space using a random single pass (one ‘pass’ means that the system overwrites the deleted files once). Number ‘2’ uses a 7-pass secure erase and number ‘3’ uses a special algorithm to perform a huge 35-pass secure erase. Obviously, the higher the number you choose, the longer the process will take. Usually, using numbers ‘1’ or ‘2’ should be more than enough to perform a safe erase. – Now, the second value you need to know is the Identifier number of the disk where you want to perform the process. For this, open Terminal and copy and paste this command: diskutil list
This will display a list of all your Mac’s hard drives. What you need to copy is the Identifier number beside your selected disk. In my case, I want to securely erase the free space on the disk with 120.5 GB, so its Identifier number would be ‘disk0s2’. With this information, you can now use the first command from above: diskutil secureErase freespace 1 /dev/disk0s2 Just make sure to keep the number on ‘1’ or to change it to either ‘2’ or ‘3’ depending on how secure you want the erase process to be. Also, change ‘disk0s2’ to your hard drive’s own Identifier number. Once ready, press Enter/Return.
After you do, just sit back and watch Terminal do its magic securely erasing all your hard drive’s free space. The above article may contain affiliate links which help support Guiding Tech. However, it does not affect our editorial integrity. The content remains unbiased and authentic.