Skip to content

Instantly share code, notes, and snippets.

@fabiofl
Created June 27, 2013 00:41
Show Gist options
  • Save fabiofl/5873100 to your computer and use it in GitHub Desktop.
Save fabiofl/5873100 to your computer and use it in GitHub Desktop.
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@tobiashochguertel
Copy link

tobiashochguertel commented May 6, 2022

sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
after that restart your mac.
wahlaaah.. all restore and back to normal

This worked really well! Thank you @zigang93.

Works!

Here for better readable and discovering the shell-snippet again:

sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder

@jbrodriguez
Copy link

@jasonm23 @andreiborisov i'm interested in changing icons via cli, doing some more debugging, found these articles:

The first one clarifies the 0 bytes size of Icon\r: the file is actually stored in the resource fork

@jbrodriguez
Copy link

jbrodriguez commented May 7, 2022

and finally this tool looks promising (although i haven't tested it myself) https://github.com/mklement0/fileicon

EDIT: i tried the tool and it works for me on Monterrey, although i still need to rebuild the cache and restart dock:

rm /var/folders/*/*/*/com.apple.dock.iconcache
killall Dock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment