Since macOS High Sierra sips --addIcon
is no longer supported.
An easier way to add and image to a file/folder is to use fileicon
npm package.
The new syntax is:
fileicon set foo img.png
The old method setIcon
is kept here a an archive:
Take an image and make the image its own icon:
sips -i icon.pngExtract the icon to its own resource file:
DeRez -only icns icon.png > tmpicns.rsrc
Append this resource to the file you want to icon-ize.
Rez -append tmpicns.rsrc -o file.extUse the resource to set the icon.
SetFile -a C file.extAppend a resource to the folder you want to icon-ize.
Rez -append tmpicns.rsrc -o $'myfolder/Icon\r'
Use the resource to set the icon.
SetFile -a C myfolder/Hide the Icon\r file from Finder.
SetFile -a V $'myfolder/Icon\r'
rm tmpicns.rsrc
Source: Stackexchange
Now at macOS 10.14, you just need below: