How do I delete Purgeable Space on a Mac?

How do I delete the Purgeable Space on Mac OS?


Mac Studio, macOS 14.1

Posted on Dec 12, 2023 10:10 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 12, 2024 5:41 PM

  1. If you decide to delete all local snapshots at once, run this command:
  2. for d in $(tmutil listlocalsnapshotdates | grep "-"); do sudo tmutil deletelocalsnapshots $d; done

If deleting Time Machine local snapshots didn't help you reclaim much free space, try the method below.

A more efficient way to delete purgeable space on Mac is by making a file that grows until the disk is full and then deleting the file. It's worth mentioning that previous attempts to create an empty file and then duplicate the file until it uses up your Mac's free space to force your operating system to clear purgeable space to store the file no longer works with APFS. 

How to purge Mac hard drive with command lines:

  1. Open Terminal from the Applications folder > Utilities.
  2. Type in the following command and hit Enter.
  3. dd if=/dev/zero bs=100m of=~/Test
  4. This command will create a file named Test that is filled with zeros in your Home directory. The file will grow fast initially and slow down when it's close to full. You will receive notifications warning you, "Your disk is almost full." Just ignore it because it will keep popping up until your disk is completely full.
  5.  When you see the message "No space left on device," execute another command to permanently delete the file.
  6. rm -rf ~/Test


44 replies

Dec 5, 2024 12:58 PM in response to Randalls-MacPro

Here is a short bash or zsh script that works:


#!/bin/bash

# Bin-bash script to remove purgeable file space

# Created on 20241205

# Change username in this script to Your user name by using FINDER - GO - HOME

# To Run script

# Open Terminal and type:

# bash /Users/username/Documents/DEPURGE/DEPURGE_generic.sh

# Create a text file with zero bytes then fill with lots and lots of zeros

set -x # Set Debugging Mode - Print each command as done

# set -e # Remove "#" sign for seeing Exit on Error for Debugging

cd /Users/username # Change to ~/HOME directory

touch text.txt # Create a zreo byte file called text.txt

# Fill text.txt with 100000 ZEROS at a time till no more space

dd if=/dev/zero bs=100m of=/Users/username/text.txt status=progress

# Delete LARGE ZERO file called text.txt

rm /Users/username/text.txt


echo "!!!! GoTo Macintosh Disk then select Get Info for Pureable Space !!!!"

echo " "

read -p "Do you want to loop again? (y/n): " answer

if [ "$answer" = "y" ] || ["$answer" = "Y" ]; then

bash /Users/username/Documents/DEPURGE/DEPURGEV3.sh

fi

# END OF SCRIPT

exit


Enjoy!!

Dec 23, 2024 6:55 AM in response to etresoft

that doesn't magically happen either from what I and others here have experienced, the OS may never release the space until forced to do so and apparently the OS upgrade and other 3rd party application operations can't account for it and get blocked.


@arek.r see various workable solutions in the discussions above for how to force a release of the space by creating temp files etc

Dec 23, 2024 7:45 AM in response to xammy-b

Here is a short bin Bash script that will reduce pureable space - usually has to be run a few times:


#!/bin/bash

# Bin-bash script to remove purgeable file space

# Created on 20241205

# Change username in this script to Your user name by using FINDER - GO - HOME

# To Run script

# Open Terminal and type:

# bash /Users/username/Documents/DEPURGE/DEPURGE_generic.sh

# Create a text file with zero bytes then fill with lots and lots of zeros

set -x # Set Debugging Mode - Print each command as done

# set -e # Remove "#" sign for seeing Exit on Error for Debugging

cd /Users/username # Change to ~/HOME directory

touch text.txt # Create a zreo byte file called text.txt

# Fill text.txt with 100000 ZEROS at a time till no more space

dd if=/dev/zero bs=100m of=/Users/username/text.txt status=progress

# Delete LARGE ZERO file called text.txt

rm /Users/username/text.txt


echo "!!!! GoTo Macintosh Disk then select Get Info for Pureable Space !!!!"

echo " "

read -p "Do you want to loop again? (y/n): " answer

if [ "$answer" = "y" ] || ["$answer" = "Y" ]; then

bash /Users/username/Documents/DEPURGE/DEPURGEV3.sh

fi

# END OF SCRIPT

exit



ENJOY

Feb 9, 2025 7:03 PM in response to Gillesb15

It's a Miracle!

Apple have descended from the Ivory tower & fixed it!

Albeit days after an update to 15.3


It gets better!

They have even fixed (for a while I'd expect - but don't bet on it!) df & du to show more

accurate data about space usage. The person in Apple that actually did this deserves

accolades!


df...

Filesystem Size Used Avail Capacity Mounted on

/dev/disk3s1s1245G 11G 174G 7% /

/dev/disk3s5 245G 52G 174G 23% /System/Volumes/Data

/dev/disk8s1 1000G 769G 231G 77% /Volumes/MyHome

/dev/disk7s2 2000G 993G 1007G 50% /Volumes/MyMacMiniBackup


du -shx WhatImInterestedIn...

23G /Volumes/MyHome/me/Library/Containers/com.apple.mediaanalysisd

9.0G /Volumes/MyHome/me/Library/Application Support/MobileSync/Backup/


Those are not unreasonable numbers - at least I'm happy with them for now!


Please convey my congratulations to the person in Apple that fixed these problems

that should never have happened & we look forward to better communication with

Apple & improvement in their technical support...


Who have 2 options for all problems,


Reboot


Log off removing all iCloud sync, then log back in.


Sorry there's a third now, total reinstall!


They really do not work!

Good programming does!


Analysis of all cache files is required - please get the software engineers (another name for

programmers) on to it, it's called appropriate maintenance!


Do not assume that 3rd party stuff & community user advice will solve bad programming

practice!



Dec 12, 2023 12:53 PM in response to VikingOSX

VikingOSX:

Thank you for your efforts to help me. It sure is appreciated.


I did as you instructed then shut down and restarted, and in the 'System Settings - General - Storage, 'Macintosh HD' Does show I have 250 GB more...


However in Disk Utility, 'Macintosh HD' (Data Volume on sidebar) does Not show any change. It still shows 259 GB purgeable. - Also, a 'Get Info' on the Folder in Finder shows the same.


Is there another Step that I missed please, that causes this discrepancy?


Thank you again,

Randall


Mar 4, 2024 1:36 PM in response to VikingOSX

Hello,

my problem is similar, 180 gb available but 165 purgeable resulting in 15 free

when trying to install a newer version of Mac OS >> not enough free space.


And deleting large file doesn’t do anything.

i backed up my music library 50 gb. (Trashed it & empty the trash) It just increased both values but free space remain 15.


the purge didn’t change anything


thx for your help.



Aug 13, 2024 5:58 PM in response to Randalls-MacPro

I am also having grief with purgeable space on my MacBook Pro. I am running Sonoma 14.6.1.


I have run sudo purge from a terminal and no relief. I have rebooted and shutdown an restarted multiple times.


I know that the purgeable space is some video files that I have edited and copied back to my NAS the moved them to trash and emptied the trash. I feel that when I empty the trash the filed should be deleted and the space recovered.


I even tried running first aid in the disk utility and still the purgeable space remains.

Oct 7, 2024 6:25 AM in response to g_wolfman

i think you need to understand it's not about dopamine but getting a job done: i can't download footage i need to work with, because the frame.io app doesn't recognize that i have 700gb purgeable space and just says i have only 20gb of free space. now you can go on all day long how frame.io didn't code their app correctly but some of us just need a solution to a considerable problem, not an ill informed lesson on how apple will magically do everything and one should just lay back.

Dec 4, 2024 11:48 AM in response to g_wolfman

How advanced a file system is does not matter when the data/statistics being produced prevents things from happening.


Linux/Unix tools might look at the available file system space to determine if an action is feasible (like copying some huge image file). The output of "df" becomes critical. So when "df" on my 1TB SSD says it only has 100GB available it simply won't do the copy. Of course, if you look via Finder, et. al. it says there's 500GB free since there's 400 purgable. Then we start down the path of trying to figure out how to get the output of "df" to actually show the truly available amount of space. Which means trying to get the OS to force the purging.


I would say that APFS is too advanced for its own good. Or at least Apple needs to polish off a lot more of the rough edges. Either fix the statistics being reported OR provide a much easier way to do the purging.


Note: in my case those timemachine snapshots were taking up the space. And timemachine IS up to date - I verified that multiple times. And rebooted. No joy. I'm going to let things take some time to "self-heal" before I take "drastic action" and remove those timemachine snapshots by hand. Seriously, I did not expect to end up down here in these weeds...

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I delete Purgeable Space on a Mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.