How to Clear the macOS System Icon Cache via Terminal

The Corrupted Icon Database

macOS prides itself on a visually polished interface, but sometimes the underlying icon rendering engine fails. You might notice that generic white sheets of paper have replaced the icons for your Microsoft Office documents, the Safari icon in the Dock has turned into a generic application placeholder, or custom folder icons you created have suddenly reverted to default blue folders.

This visual glitch occurs when the macOS Icon Cache (specifically the com.apple.iconservices directory) becomes bloated or corrupted. While restarting the Mac or rebuilding the LaunchServices database can sometimes resolve application icon issues, a deep corruption of document and system icons requires a forceful purge of the Icon Services cache using the Terminal.

Locating the Icon Cache

Unlike standard application caches stored in ~/Library/Caches, the system-wide icon cache is buried deep within the Darwin kernel’s secure temporary directories. These directories are protected by strict permissions, meaning you cannot easily navigate to them using the graphical Finder.

You must use the Terminal with elevated (sudo) privileges to access and delete them.

Purging the Icon Services Directories

To forcefully clear the icon caches, you must delete specific directories located within the /Library/Caches/ folder.

  1. Open the Terminal application (located in Applications > Utilities).
  2. Execute the following command to delete the primary Icon Services cache:
sudo rm -rf /Library/Caches/com.apple.iconservices.store

Press Enter, type your Mac’s administrator password (the characters will not appear on screen), and press Enter again.

Next, you should delete the secondary cache directory, which handles the user-specific icon rendering:

sudo rm -rf /private/var/folders/*/com.apple.iconservices

Warning: The rm -rf command permanently deletes files without moving them to the Trash. The wildcard (*) in the second command ensures that the cache is cleared for all user profiles on the machine. Ensure you type these commands exactly as written.

Killing the Icon Services Daemon

macOS relies on a background service called iconservicesagent to read these databases and draw the graphics on your screen. Because this service is currently running in memory, it is still holding onto the corrupted data, even though you just deleted the files on the hard drive.

You must forcefully terminate the daemon so that macOS spawns a fresh instance.

killall -KILL iconservicesagent

The Final Reboot

Do not be alarmed if your screen flashes, or if all the icons on your desktop suddenly vanish or turn into generic placeholders immediately after running the kill command. The system is currently running without a cache.

To complete the process, you must Restart your Mac.

During the reboot sequence, the macOS kernel will recognize that the com.apple.iconservices directories are missing and will generate a brand-new, clean cache architecture. When you log back in, all your application and document icons will be correctly rendered and restored to their original state.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.