Create a gist now

Instantly share code, notes, and snippets.

Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@KenanSulayman

Pretty sweet. Saved the face of my dock after I migrated to OS X Yosemite DP1 from Mavericks.

@scherii

Unfortunately it doesn't help with the invisible Finder icons (Yosemite DP1-3)

@inket

@scherii This worked for me on Yosemite DP3!
It's what I needed to do after replacing folder icons with LiteIcon.

sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \;
sudo mv /Library/Caches/com.apple.iconservices.store com.apple.ic

Just being careful on the last one (renaming instead of removing)

@NotAlexNoyle

Thank you! This helped with my issue. Was trying to install Java 8, which requires "10.7+". I guess it recognized 10.10 as 10.1.0 and wouldn't let me install it. I had to edit my systemversion.plist to install it, (risky and stupid); and it messed up my icons even after I reverted the .plist to 10.10 after installing.

This command fixed it! I really do appreciate you posting this.

@jasonm23

If you only want to update one Application icon, ie, in App.app/Contents/Resources/App.icns just touch the App.app folder. (I've read you need to do the Info.plist as well sometimes, although I've never needed to.)

Close the finder windows and:

touch /Applications/App.app
touch /Applications/App.app/Contents/Info.plist

You can refresh the dock icon cache using the commands above, also do a killall Dock to restart it. Personally I would just drag the application in question, off the dock and re-start / keep in dock, because this is generally a one off thing. As always, script it if possible / and you're doing it a lot.

@mabbbbbbbbbbb

@jasonm23 Nice!

touch /Applications/App.app
@MarkLeMerise

@jasonm23 Worked perfectly! Thank you!

touch /Applications/App.app
touch /Applications/App.app/Contents/Info.plist
killall Dock
@Ardakilic

@jasonm23 Thanks, worked flawlessly!

@Robpol86

@jasonm23 very nice, almost TOO easy.

@FelixAkk

@jasonm23 Simple and for me the first trick that does work. Superthanks! :)

@tcelestino

why?
Imgur

Oo

@binaryrefinery

@tcelestino you need to replace 'App.app' in your command with the application name you want to 'touch' (eg. Evernote.app)

@dessalines

The touch commands worked for me! Thanks

@spotcatbug

Awesome. I've had a generic app icon for a particular app and it's been bugging me for months. I finally hit on the correct Google search and ended up here.

touch is the secret sauce.

@orome

Changing (and applying) app settings using whatever UI the app provides for doing so may also work (effectively this will do what touch does, but without possible side effects that makes the app unhappy).

@dkmn

Thanks, this was very helpful. I recently had corruption of almost every Application icon (unable to launch) after upgrading to 10.11.3.
After many maneuvers, I eventually fixed that by rebuilding the "Launch Services" database with Onyx.
However, the Dock icons were still corrupt. Running your script here and then "killall Dock" fixed the problem.

@legomind

Worked for me after updating to 10.11.3. Thanks!

@kaishin

Nice tip.

@chuyik
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
sudo find /private/var/folders -name com.apple.iconservices -exec rm -rf {} \;   # Without `/` after `folders`

This two commands are helpful!
Works on 10.11

@ProbonoBonobo

@jasonm23

+1. Thanks for the tip!

@VSEphpbb

Thanks.. This fixed my issue: Fresh installed El Capitan, installed apps, migrated over documents. Some document icons displayed as a blank generic file (but only when displayed as a small icon).

This command worked fine. Just know you need to enter user password for it at the prompt.

sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;

This one failed for me, I think it couldn't find it.

sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \;

This resulted in an odd folder in my user's home directory which I just deleted.
screen shot 2016-03-16 at 8 31 04 am

sudo mv /Library/Caches/com.apple.iconservices.store com.apple.ic
@skipjackyu

Now I want to find an App's icns that I once replaced but I don't know where it is.I know that the DEFAULT .icns is in the /Applications/app.app folders.

@Falven

The two commands above did not work for me on OS X 10.11.4. After running them, and resetting my machine, my file icons are still of an old app I uninstalled.

@malyw
sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \;
sudo rm -rf /Library/Caches/com.apple.iconservices.store
killall Dock

worked for me on OSX El Capitan

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