Browse the docs

Set file icon

Gives a file or folder a custom icon from a picture file.

Set the icon of path to icon

Keyboard Maestro: SetFileIcon

Details #

Sets the Finder icon of path to the picture in icon. Both can use ~ for your home folder and can use variables. Any picture macOS can read works, such as PNG, JPEG or an .icns file.

The step checks both files first. It fails if nothing is at path, if there is no picture at icon, or if macOS cannot read icon as a picture. It has no output.

Parameters #

ParameterTypeRequiredValuesWhat it does
icontextYesThe picture to use as the icon. Required.
pathtextYesThe file or folder that gets the icon. Required.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Replace both paths first, since this really changes the folder's icon:

Give a folder a custom icon (really changes it)
Do
  1. Set the icon of “Projects”
  2. Show “Icon set”
Open in Switchboard to try it

Gotchas #

  • The step fails with "couldn't set the icon of …; is the file writable?" when macOS refuses, for example for a file you cannot write to.

  • In a dry run the step is simulated and no icon changes.

See also #

File operation, Get or set a file attribute