Delete Junk Files on macOS

Junk files are unnecessary files produced by the operating system or software. Junk files keep increasing, but our computer disks are limited. So we need to delete junk files regularly. Otherwise, we may not have enough free space to use.

In this post, I will guide you to delete junk files on macOS.

Delete OS and Third-Party Software Leftovers

JetBrains

Remove JetBrains old version leftovers

  1. Open the JetBrains Toolbox App.
  2. Navigate to Settings: Click the gear icon in the upper right corner.
  3. Go to the “Tools” section: Expand the “Tools” section.
  4. Find “Clean up leftover tool directories”

HomeBrew

1. Clear outdated or unused packages and downloads from Homebrew

Remove stale lock files and outdated downloads for all formulae and casks, and remove old versions of installed formulae:

brew cleanup
# Show what would be removed, but do not actually remove anything.
brew cleanup --dry-run

2. Remove unused dependencies

Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed:

brew autoremove
# List what would be uninstalled, but do not actually uninstall anything.
brew autoremove --dry-run

Delete Software Cache Files

Docker

1. Remove all unused containers, networks, images (both dangling and unused), and optionally, volumes.

docker system prune

What is does:

  • Removes all stopped containers.
  • Removes all unused networks.
  • Removes all dangling images (images that are not tagged and not referenced by any container).
  • Removes all build cache.

2. Remove Docker images on Docker Desktop

Remove Docker images that you no longer need on Docker Desktop.