Right-click (on Mac, click with two fingers) in empty space in the right pane and choose Wipe available diskspace. The cleaning starts. It can last from a few minutes to a few hours, according to the size of the available diskspace. Be patient Note that a file with a name similar to tmp.7JwHAyBvA9 is created in the folder. Bullroarer asks: 'How do I perform Terminal commands on any items on my Mac that have spaces in their pathnames? Because Finder allows spaces in file and directory names, I'm often creating such with spaces but then if I try to cd to one in the Terminal the space kills the command. Jun 25, 2020 Since Mac OS 10.7, Apple has also included a built-in tool to view both free disk space and detailed disk usage that can be accessed through the “About This Mac” window. Here’s how to see it. First, click on the “Apple” menu in the upper-left corner of the screen and select “About This Mac.”. Before wiping the free space on your Mac using the command line, back up your data. Once you’ve backed up your data, open the Terminal app from the Applications Utilities folder.

If you’re selling an old Mac, a spare hard drive, or you’re just quite paranoid about your deleted data, you’re either familiar with—or should be familiar with—the Erase Free Space button on the Erase tab in Disk Utility (found in your Applications -> Utilities folder).

When you click this button, you’re presented with three options for securely erasing the free space on your hard drive: write over the free space with zeros (fast and relatively safe), write over the free space seven times (more secure, very slow), or write over the free space 35 times (extremely slow!).

Terraformers: Space Command Mac Os Download

I use this feature whenever I sell an old machine. First I format the drive and install a fresh copy of OS X, then I use Disk Utility to erase the free space (typically the one-time write-with-zeros option). This gives me a good sense of security, as it would take a team of dedicated professionals, and possibly special hardware, to have some chance of recovering any of my deleted data—though I really only care about a few financial files, and those are kept on an encrypted disk image, so they’re probably safe anyway.

So that’s how you securely erase free space using a standard OS X application. But what if you need to do this from Terminal instead? For instance, say you’ve only got remote login (ssh) access to another Mac, and you’d like to wipe its free space. Or you’re really paranoid, and would like to schedule a task (using cron or launchd) that regularly erases the free space on your drive.

It turns out OS X has an answer for that challenge, too.

(Please note that, as with many Terminal commands, there’s a chance of Really Bad Things happening if you make a mistake with the following instructions. Proceed with caution, and make sure your backups are current before you try any of the following.)

In Terminal, a program named diskutil provides most of the features of OS X’s Disk Utility. To find out about it in detail, type man diskutil at the Terminal prompt. Within the man pages, you’ll find the explanation for how to securely erase a disk’s free space using diskutil:

But how do you figure out what to list for device, which is the disk (or partition) that has the free space you’re trying to securely erase? diskutil can provide that information, too. Just use diskutil list to see a list of all drives and partitions. On the far right, you’ll see an IDENTIFIER column; that column contains the identifier that diskutil needs. Here’s an example of the list output on my machine:

There’s just one last bit of information you need to know to erase the free space on a drive from the command line. In Unix, all devices appear as part of the file system tree, and in OS X, they’re all listed in the /dev directory. So if I wanted to use diskutil to erase the free space on my mwfiles volume, using the single-pass method, the final command would look like this:

Warning! It’s critically important that you include the freespace portion of that command. If you don’t, diskutil will happily start securely erasing the entire disk, instead of just the free space! Yes, that’s a Really Bad Thing, especially because it will be securely erased, meaning there’s no chance you’ll be able to recover the data. “With great power comes great responsibility.”

Once you understand how this command works, you can then use a program like Lingon to set up a repeating task to regularly erase your drive’s free space.

Terraformers: Space Command Mac Os X

TIL about Purgeable Disk Space in OSX, and after hours of struggling, how to reclaim it.

Terraformers: space command mac os catalina

What is Purgeable Space?

Purgeable Disk Space is a “feature” of more recent versions of OSX. It is storage on your hard drive that the operating system sets aside for files that it thinks you might access again in the future.

An example of files that are moved to purgeable space is files that you send to your remote iCloud storage. Presumably, you are sending files to the cloud to free up space on your local machine… if there is space available locally on disk, though, OSX will keep these files around in purgeable space which speeds up accessing the files again from your local machine.

In my opinion, it’s a bit of a silly assumption on behalf of the OS to keep files around that the user is asking to send to remote storage.

I ran in to issues with purgeable space when trying to partition my hard drive for a Windows installation. I had over 40GB of my hard drive confined to purgeable space, and even though that storage counts as “free” from an OSX perspective, it is still technically allocated. This prevented me from being able to pull in as many GB in to my Windows partition as I needed.

Even though I haven’t experienced it, I have also heard of folks running in to issues installing games or downloading large files onto their machines, and hitting the purgeable space wall.

There has to be a way to reclaim purgeable space from the OS, right?

How to Free Purgeable Space

It isn’t as easy as it sounds.

There are apps like cleanmymac3 which offer to clean purgeable space on your machine (for a fee) but I wanted to find a way to reclaim this space without the need for a paid service.

Terraformers: Space Command Mac Os 11

Purgeable space is freed when you ask the operating system to store a new file that exceeds the amount of true free space left on disk.

For example, if I have 15GB of space left on my disk, 5GB is truly “free” and 10GB is purgeable, If I create a file that is 6GB large, I will use up the rest of the “free” space and 1GB of purgeable.

Once the file that reclaimed the purgeable space is deleted, the space goes back to being truly free, instead of purgeable again!

So the trick is to create enough large files locally that all of the purgeable space is reallocated to support the new large files. After deleting those files, your space will return to a truly free state, instead of returning to purgeable.

One important caveat that I learned while attempting this solution: if you create a big file locally, and duplicate it over and over again with cmd+c/cmd+v or cmd+d, your disk space will not be properly filled up. This is an OSX trick to try and conserve hard disk space for duplicate files, by just creating new references to the original file instead of brand new copies of the file itself.

This is a good feature in most scenarios, just not in our immediate case where we actually want to fill up our disk as fast as possible.

See my step-by-step instructions for creating large files and duplicating them in the next section:

Terraformers: space command mac os x

Space Command Tv

Step by Step Instructions:

  1. Open your terminal by searching for terminal in spotlight (open spotlight with cmd+spacebar)

  2. In the terminal, execute mkdir ~/largefiles
    • This creates a new folder called “largefiles” in your home directory.
  3. In the terminal, execute dd if=/dev/random of=~/largefiles/largefile bs=15m
    • This will create a new file called “largefile” in your largefiles folder, which contains the random output from /dev/random.
    • NOTE: this command will cause your terminal to appear like it is frozen… that is expected, as the command is running!
  4. After a few minutes (around 5), hit ctrl+c in the terminal window to kill the command from step 3.

  5. In the terminal, run the command cp ~/largefiles/largefile ~/largefiles/largefile2
    • This will copy the largefile that was created in step 3 to a new file called “largefile2”.
    • Remember, this is different than just running cmd+d or cmd+c/cmd+v on the file… it’s forcing the file to be copied over in its entirety, filling up more space on disk.
  6. Continue to run the copy command from step 5, changing the name of the copy destination from largefile2 to something different each time.
    • Change the copy destination name to something like largefile3, largefile4, etc…
    • You should continue to run this command until you see a OSX message appear that says “disk is critically low”.
  7. After you see the disk critically low message from OSX, execute rm -rf ~/largefiles/
    • This will delete all of the largefiles from your system.
    • Make sure you empty the trash bin as well, or the files will just sit in there taking up space!
  8. Open disk utility by searching for disk utility in spotlight
    • You should see either no amount of purgeable space, or a very small amount of purgeable space remaining in your hard drive snapshot!

Space Force

The procedure above was inspired from this stack overflow post.

I hope the above was helpful! Feel free to reach out to me if you’re still having trouble freeing the purgeable space on your mac.