thoughts.theden.sh


Free Up Disk Space on MacOS

Ignoring system caches, and logs in general for safety.

Brew’s Cache #

brew cleanup --prune=all -s

The ~/Library/Caches/ Folder #

Though one could be brutal and wipe the entire folder

sudo rm -rfv ~/Library/Caches/

It may have unintended consequences, it’s better to only delete the larger folders/files, i.e.,

sudo du -sm ~/Library/Caches/* 2> /dev/null | sort -n

Will list the folders in the directory sorted by size in MBs.

Xcode Cache Data #

To delete the derived data

rm -r ~/Library/Developer/Xcode/DerivedData/*/

For cached files

rm -rf ~/Library/Developer/CoreSimulator/Caches/dyld/*/*/
xcrun simctl delete unavailable

Flush the DNS cache #

sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

CUPS Printer Job Cache #

To delete your printer job cache

rm /var/spool/cups/cache/job.cache*

QuickLook Thumbnail #

Using the QuickLook Server debug and management tool

qlmanage -r cache