macOS app icon not updating. Cached?

Hi,

If I change the AppIcon in Xcode's Assets.xcassets, and rerun my app, the image used in the dock and app switcher does not update. If I "Clean Build Folder", and re-run, then it updates.

This is annoying when I keep tweaking the colors in the icon and want to see how they look. A full rebuild takes a while, because I have a few Swift Package dependencies.

Anyone know a trick to get the AppIcon to stop caching (or whatever it's doing)?

I tried killall Dock and killall Finder, but that didn't help.

(macOS 11.2.3)

Rob
Yes, there is a lot of caching here.

Lucky enough to force change with Clean Build Folder.
If I look at the built binary in Finder (without doing a Clean Build Folder), it does have the updated icon. But running it uses the old icon in the dock and ⌘-Tab app switcher. Odd.

The following Terminal command worked for me:

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

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

Answer by @shenlong2210 worked for me, though for zsh I needed slightly different syntax:

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/* 
touch ~/Applications/*
killall Dock
killall Finder

(I didn't use the touch commands and it seemed to work for my situation.)

macOS app icon not updating. Cached?
 
 
Q