Dock icons switch to generic ones

Solution 1:

I would start with a reset and restart of your Dock.1

To reset and restart the Dock, follow these steps:

  • Go to Finder
  • Press and hold the option key down
  • Now go to the Go menu
  • Select the Library option to open the User's Library folder. You can let go of the option key now.
  • Go to the Preferences folder (i.e. within the Library folder)
  • Find and move the com.apple.dock.plist file to the Trash
  • Now open Terminal (usually located in Applications > Utilities)
  • Enter this command killall -KILL Dock
  • Press enter

Once you've done that, use your MBP for long enough to know if this has resolved the issue.

1IMPORTANT: After doing this you will need to re-add any non-default icons (i.e. apps) that you've added to the Dock. Before proceeding you may want to take some notes (or a screenshot of your Dock) as a reminder of what you had there previously.

[UPDATE]

Since what you've been doing with your bash script is essentially the same thing, I would try booting into Safe Mode.

Boot into Safe Mode

Follow these steps to boot your Mac into Safe Mode:

  1. Fully shut down your MacBook Pro
  2. Restart your MacBook Pro
  3. Immediately press the Shift key and keep it down
  4. Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
  5. Take a note of what happens (i.e. how does your Dock look, etc)
  6. Exit Safe Mode by restarting your MacBook Pro as normal
  7. Now check to see how your icons look

Once you've booted into Safe Mode, if the problem still persists, follow my steps above for resetting and restarting your Dock and see if that makes any difference.

Also, if the problem isn't there while booted into Safe Mode, but returned when booted normally, let me know. This will require further troubleshooting as it's clearly a software conflict/issue.