iconutil not working on macOS High Sierra

1.2k Views Asked by At

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.

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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:

http://eon.codes/blog/2016/12/06/Creating-an-app-icon/

0
On

iconutil will not create fully compatible .icns in High Sierra. Use image2icon app to create your icons folder. You will see 10 .pngs. This is what High Sierra needs , but iconutil will create a .icns file with only 8. This is fine if all you want to do is make your disks look pretty on your desktop, but will not change the boot menu!