9

Today I want to install Catalina but it requires 17 GB of disk space, and I only have 8 GB. So I started to delete files but only found out that the disk space was unchanged or even shrinked more after deleting.

I just delete files either by moving the files to Trash and empty it, or rm -rf. The files are both on local and iCloud.

I deleted at least 40 GB files but the available disk size is still about 8 GB. Why is it happening and how can I gain the disk space?

I restarted a few times but it didn't work...

(This question is not about the external drive.)


enter image description here

I found that there are awkward files under ~/Library/CloudStorage/iCloud Drive, and how many times I delete them these files show up again under this directory.

All of them seem to just a few bytes files according to the Finder information, but deleting them takes a few minutes per one file.

7
  • 1
    are the deleted files in icloud also?
    – Natsfan
    Jun 18, 2019 at 23:28
  • @jmh yes and no. Some files, like Xcode, are only in local but the disk space is not released.
    – Blaszard
    Jun 18, 2019 at 23:29
  • Have you tried deleting the files from icloud.
    – Natsfan
    Jun 18, 2019 at 23:30
  • @jmh yes, and I opened the iCloud Drive from Finder and deleted them.
    – Blaszard
    Jun 18, 2019 at 23:31
  • 1
    @jmh There was 8 GB before trying to install. On the install dialog, I was informed to need another 9 GB, so I started to delete files.
    – Blaszard
    Jun 18, 2019 at 23:43

4 Answers 4

12

On the assumption that you have APFS file system, macOS 10.14 Mojave, and local snapshots - the system might take some time to purge the space. Just like a backup where the point is to go get a copy of a file you deleted after the delete, snapshots show the contents of a disk in the past and allow you to grab a copy of a past file while that snapshot exists.

You should also not be deleting the stub files in iCloud. If you run low on disk space, they take no space locally and exist in the cloud only, downloading on demand.


Here are some details on snapshots from 2019. One easy way to check space is to open the system information app (or look in storage portion of about this Mac) and give it several minutes to catalog all the space into buckets. Your 40 GB of space that could have been 40 GB of documents will show up as grey colored System once the process completes. On more recent OS (2021 and later), open Disk Utility and select view APFS snapshots (command - shift - S) to see the space used by snapshots.

Second - check for local snapshots

tmutil listlocalsnapshots /

I like to use Disk Utility to examine the Private Size and Tidemarks of each snapshot to decide what to do before proceeding.

macOS Disk Utility showing data volume snapshots

There are command line options to force a purge of APFS snapshots:

tmutil thinlocalsnapshots / $(echo "10 * 1000000000" | bc) 2

If you don't have these, I would suggest making sure you have a good backup and restart to recovery mode and run a disk check to be sure the accounting / filesystem are in good shape.

The next thing to do would be to turn off iCloud and let all those files exist only in the cloud. This will prevent a local storage taking space.

Once you install the upgrade, you can turn on iCloud again and only download the files you need locally.

If my explanation isn't clear or you want more graphical tools to assist, please read these two excellent pieces by an author I respect and admire for their clarity of writing:

9
  • In my answer the $(echo "10 * 1000000000" | bc) calculates out 10 GB and the 2 raises the urgency of the “delete” from the default value. You could just do tmutil thinlocalsnapshots / 500 2 several times until you see the space free you desire.
    – bmike
    Jun 19, 2019 at 0:06
  • Thanks but I don't use Time Machine. I just tried to log out of iCloud but it keeps shrinking, and now I only have 6.7 GB available... It's very awkward.
    – Blaszard
    Jun 19, 2019 at 1:04
  • 2
    And in addition to what bmike said: APFS shadow-links files on the filesystem, which is why when you copy a file and paste it somewhere else it appears instantly. If you delete a file and there's another identical file on the filesystem, only its link will be removed and the data connected to it left untouched. Therefore, in this case, removing the file will not result in a reduction of disk space.
    – 19h
    Apr 12, 2020 at 18:40
  • 1
    Hi @PatMyron Thanks for the comment. I don't think it's as straightforward as that. Let me see if there's a good article and then make an edit here. I'll ping you when that happens. My main advice, is look at your APFS snapshots and purge them manually if you don't want to wait a day for Time Machine to start cleaning the most typical snapshot. Many people that don't feel they are using Time Machine have snapshots the system makes and that process cleans them in the background.
    – bmike
    Feb 16 at 18:14
  • 1
    @PatMyron If my added content doesn't help, please write a new question with your specifics and I'll be glad to have a look at your situation.
    – bmike
    Feb 16 at 18:39
3

Did you try clearing Purgeable Space on your Mac? If not, you can follow these steps to remove Purgeable space on your Mac running Sierra or Mojave:

  • Open the Terminal application in Applications/Utilities.

  • Enter the following into the Terminal window to start making a file that will
    grow until the disk is full: dd if=/dev/zero of=~/stupidfile.crap

The command will create a file called stupidfile.crap in your Home directory and fill it with zeros. During the creation of the file, you will get a lot of warning messages that the disk is full. Just leave it there, because if you close it, it will reappear after a while.

When the Terminal window command ends with the message “No space left on device,” the disk is full, and mission accomplished. Mac OS should now have removed all the Purgeable space from the drive. Don’t forget to empty the trashcan to regain the space.

Source: https://www.jackenhack.com/mac-os-remove-purgeable-high-sierra/

If it doesn't help, OmniDiskSweeper http://www.omnigroup.com/more may also help you identify where the space is going. Good luck!

7
  • Do you take any precautions as you fill your disk with stupid crap (I love the naming) like disconnect from the network so you don't break a iCloud download or sync or just "let-er-rip!" and hope the system remains responsive enough to cancel the operation cleanly?
    – bmike
    Jun 19, 2019 at 11:04
  • 1
    Hi, yes, it seems like a good idea to disconnect from the network. I tried this on my Macbook running High Sierra. My system did become slower, and I got couple of warnings. I didn't close any warning messages and all went well.
    – Charles S
    Jun 19, 2019 at 11:10
  • That's excellent. I would be chicken to do that on my important computers, but for science on a test Mac... Mind if I suggest a light edit? You can roll back or further edit if mine aren't to your taste.
    – bmike
    Jun 19, 2019 at 11:27
  • Hi bmike, please don't hesitate to suggest a edit. I'll accept it right away!
    – Charles S
    Jun 19, 2019 at 11:40
  • 1
    It may be obvious, but the quote left out an important step: to move the "stupidfile.crap" into the Trash before emptying.
    – WGroleau
    Nov 26, 2019 at 19:58
0

TLDR: My workaround to access post-Catalina /Users/Shared/Relocated Items involved continuing to use this folder. But deleting/moving to trash files from this location DID NOT recover disk space.

I keep a Data directory outside of my user home folder, because I handle backups of these big/transient files differently. With my installation of Catalina (10.15) and its separation of my SSD into separate diskName and diskName - Data APFS volumes I found the BIG Data dir had been moved into /Users/Shared/Relocated Items/. Hmmm. My hack was to create a simple alias/symbolic link ~userName/Data —> /Users/Shared/Relocated Items/Data and have proceeded like that since, merrily adding and deleting new data under this path.

But for reasons I don’t understand, file space DELETED under /Users/Shared/Relocated Items/ does not seem to be recovered. Even after Emptying Trash. Even after using System/Storage Management to confirm Purged files are gone. Disk Utility says the file system is in fine shape. Rebooting changes nothing.

My fix has been to copy the contents of /Users/Shared/Relocated Items/Data to an external drive, DELETE the entire directory, create a new directory /System/Volumes/Data/myData, and then copy all the data back from the external drive into this new directory.

Here's hoping my pain is your gain!

0

One possible cause of not seeing spaced get freed up even after deleting gigabytes of files is that MacOS is keeping files around as "purgeable" until it can be backed up by TimeMachine. The storage view in About This Mac might say you have free space, but Disk Utility says you don't. The problem I had was I had TimeMachine setup, but there was no external drive connected for a while. I ended up having ~460GB of purgeable disk space sitting around as TimeMachine snapshots. If you aren't going to reconnect the TimeMachine drive, then to remove these snapshots, run this command in Terminal: (you may have to disable TimeMachine first)

tmutil thinlocalsnapshots / 999999999999999 4

And after a little while you should see output like the following.

Thinned local snapshots:
com.apple.TimeMachine.2022-12-21-110658.local
com.apple.TimeMachine.2022-12-21-121438.local
com.apple.TimeMachine.2022-12-21-131317.local
com.apple.TimeMachine.2022-12-21-141449.local
com.apple.TimeMachine.2022-12-21-152339.local
com.apple.TimeMachine.2022-12-21-163251.local
com.apple.TimeMachine.2022-12-21-172842.local
com.apple.TimeMachine.2022-12-21-182910.local
com.apple.TimeMachine.2022-12-21-192839.local
com.apple.TimeMachine.2022-12-21-212540.local

And your DiskUtility will report correctly the amount of free space.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .