How to clean download cache of `softwareupdate`?

Solution 1:

On terminal run (type in your password and this account needs Admin rights on the mac):

sudo find /private/var/folders -type d -name "downloads"

On my Big Sur machine it returns a lot of 'Operation not permitted' but also two finds:

...
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/C/com.apple.quicklook.ThumbnailsAgent/com.apple.QuickLook.thumbnailcache: Operation not permitted
/private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads
/private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/softwareupdated/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads
find: /private/var/folders/zz/zyxvpxvq9csfxvn_n0000000000000/0/com.apple.LaunchServices.dv: Operation not permitted
...

Rather then on the former mentioned mount volume /System/Volumes/Update the /private/var/folders/ is part of mount volume /System/Volumes/Data .

The two interesting founds need a real root access. So from now on be really careful what you are doing on your system! On terminal run (type in your password and this account needs Admin rights on the mac):

sudo su

Now check your founded download folder on size used with du command. Here is the example I did on my machine:

%n@%m %1~ %# du -sh /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads/*


0B  /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads/00

...


29M /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads/06

...


0B  /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads/60

You see one folder on my machine is 29 MB large. So I followed this path to the end and list its content and found a partially downloaded Safari 15.0 there. This is interesting since I already have Safari 15.1 installed. Maybe a download of 15.0 was interrupted in the past and now still uses disk space here.

%n@%m %1~ %# du -sh /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads/06/32/002-02865-A_VQHMW5SC23/x193wtjutj4ik3o83rn5fd5fh7xeb694yb/Safari15.0BigSurAuto.pkg.PKDownloader-Partial/CFNetworkDownload_7ILPuD.tmp 


29M /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/swcdn.apple.com/content/downloads/06/32/002-02865-A_VQHMW5SC23/x193wtjutj4ik3o83rn5fd5fh7xeb694yb/Safari15.0BigSurAuto.pkg.PKDownloader-Partial/CFNetworkDownload_7ILPuD.tmp

Now it is on to you how brave you are if you like to mess with the files here or not. Normally messing with files in /private/var/folders/ is a totally no go! I have not done this on my own and I don't know the side effects yet. I just show you how to find the download cache of softwareupdate. I hope you have backuped all your data just in case!

Added later:

I just found out a safe way to clear all the cache files of macOS is to boot your machine ones in safe mode. I tried this and now my partially loaded Safari 15.0 is gone. Then just boot again to be in normal mode again. See here at Apple how you do a safe mode boot: Start up your Mac in safe mode