Can’t Remove Purgeable Disk Space
When trying to install Bootcamp on my Macbook Pro, I had to delete a lot of files to get enough space to be able to accommodate for a Bootcamp partition on the drive. But even after deleting around 60 GB of storage, Mac OS Sierra could still not make a large enough partition for Windows. When checking with Disk Utility it showed that indeed I had enough space, but there was a part called Purgeable that was impossible to move. No tools from Apple are available to handle this, but here’s how I fixed it.
Optimize Disk Storage
Apple added a feature called “Optimize Disk Storage” in Mac OS Sierra. The idea is quite good, unfortunately it isn’t implemented very well. If you have it enabled in System Preferences under iCloud/iCloud Drive settings (which I think is on by default), you essentially have two different values of how much disk space you have available. One “real”, that shows exactly how much there is, and then you have the Purgeable part, that includes software that can be uninstalled on the fly and later restored if enough space is available.
My problem was that Mac OS Sierra refused to remove the Purgeable part of the partition, so when I tried to install Bootcamp, It only showed the “real” free disk space. Problem is, I manually deleted stuff like iMovie and Garageband with the associated files by hand using OmniDiskSweeper, which is a free and very good application for finding and removing large unused files on your disk. But for some reason, Mac OS Sierra refused to recognise that I actually had the free disk space. After searching around the net, I couldn’t find a good solution. But after a quick hack, I’ve created an easy way of forcing Mac OS to remove the “Purgeable” disk space.
How to remove Purgeable Disk Space
First I created a 20GB file using the Terminal application. It’s easy enough thanks to Mac OS Unix underpinnings. Open the Terminal application, found in the Utilities-folder in Applications. Don’t let the sparse interface scare you, this thing has super powers!
Enter the following:
dd if=/dev/random of=~/stupidfile.crap bs=20m
This creates a file named stupidfile.crap using a device available on Unix/Linux, called /dev/random which just gives you random data that we then use to create a large file.
You could just do a periodic “Get Info” in the Finder to check on how large the file is. Another is to install Brew and use it to install the great tool watch by entering the command
If you do, just open a new Terminal window and enter:
watch ls -alh ~/stupidfile.crap
Now we can see the file size while it’s created. When the file is about 10-20GB in size, just press ctrl-c in the first window to stop creating a file. You can now quit the Terminal application.
Large file, let’s fill the disk!
So now we have a large file. No need to use the /dev/random function to make a larger file, because it’s faster to just duplicate the stupidfile.crap we just created. So go to you home directory, select the file stupidfile.crap and press cmd-d to duplicate the file. Just keep doing several duplicates at the same time to speed things up. This will make a lot of copies of the file in your home directory. What were aiming for, is to fill the disk so the OS starts purging (hence, eating into the “Purgeable” part.)
Sooner or later you’re going to hit the magic wall and you’ll get messages that the disk is full. Wait awhile and see if it has removed parts of the Purgeable section using /Applications/Utilities/Disk Utility. If the system allocates more free space, keep duplicating our dummy file. Sooner or later, you will have a very full disk with either a very small or nonexistent “Purgeable” section on it.
Time To Turn Off “Optimize Mac Storage”
Now you can turn off that pesky Optimize Mac Storage function. So go to System Preferences/iCloud, press the iCloud Drive Options button to get to the setting. Deselect “Optimize Mac Storage”.
Now you can remove all the dummy files we created to fill up the disk and voilá, we now have access to all the empty disk space without that stupid Purgeable part there.
So now I could make a larger partition for Windows. Why a larger portion for Windows? Games of course!