xcodemacoscocoaiconsiconutil

How to manually create icns files using iconutil?


When I'm validating my app I get this error:

the application bundle does not contain an icon in ICNS format, containing both a 512x512 and a 512x512@2x image.

I use to make the icns icons with Img2icns app and until today it always worked properly. But now I'm getting that error and there's no way to make it work. I tried to put two PNG files together (512x512 and 1024x1024) in Img2icns but I always get that error. I also tried to follow the instructions in Apple's OS X Human Interface Guideline but when I try to make the icon sets I get this terminal error:

-bash: syntax error near unexpected token 'newline'

I am not very good with terminal commands so maybe I'm doing something wrong. I wrote:

iconutil -c icns </Users/myname/SDK Mac Apps/MyApp/grafica/icon.iconset>

If anyone could help it would be very much appreciated. Thanks, Massy.


Solution

  • Checkout the following instructions (link):

    Use iconutil to Create an icns File Manually

    The iconutil command-line tool converts iconset folders to deployment-ready, high-resolution icns files. (You can find complete documentation for this tool by entering man iconutil in Terminal.) Using this tool also compresses the resulting icns file, so there is no need for you to perform additional compression.

    To convert a set of icons to an icns file

    Enter this command into the Terminal window:

    iconutil -c icns <iconset filename>

    where <iconset filename> is the path to the folder containing the set of icons you want to convert to icns. The output is written to the same location as the iconset file, unless you specify an output file as shown:

    iconutil -c icns -o <icon filename> <iconset filename>

    In other words, you need to replace <iconset filename> by the path:

    /Users/myname/SDK Mac Apps/MyApp/grafica/icon.iconset
    

    Since the path contains spaces, you need to use double quotes, for example:

    iconutil -c icns "/Users/myname/SDK Mac Apps/MyApp/grafica/icon.iconset"
    

    This command should work properly.