MacOS – Changing icon of a mounted disk image

dmgiconmacosmount

I want to modify the icon of my mounted disk image, the same way as FUSE for OS X.

My desktop screenshot, where my disk image is the left one (name is censored):

Dekstop

Changing the icon of the dmg is simple, but has no effect on the mounted drive.

Best Answer

The, e.g., osxfuse-2.8.2.dmg disk image file uses a hidden .icns file named .VolumeIcon.icns in the root of the volume and has the Custom Icon attribute set, probably using /usr/bin/SetFile. E.g.: SetFile -a C /Volumes/FUSE\ for\ OS\ X

You can also change the icon of the mounted disk image from its Info sheet. Place the wanted icon on the Clipboard then select the disk image on the Desktop and press Command-I then click the icon in the upper-left corner of the Info sheet and paste the wanted image there.