I use iconutil
command-line tool to convert iconset folders to icns
files:
iconutil -c icns /path/to/my.iconset
I run it in Xcode as a build phase.
I get my.icns file, but when I try to open it, I get an error message from the Preview app:
The file "my.icns" could not be opened.
It may be damaged or use a file format that Preview doesn't recognize.
I have the latest macOS High Sierra version 10.13, build 17A365.
Has anyone faced with this issue? Any ideas on how to workaround this?
You need to be strict about size when using iconutil
in high sierra. Make sure the png size is exactly 1024x1024px. Or else it won’t work. Basically the iconutil
has been upgraded in High Sierra. I tested a 1000x1000px file in Sierra and it worked. But not in High Sierra. So make sure your source png is the correct size.
Other "gotchas" that you need to be strict about when using iconutil
can be found in the article bellow: