DEV Community

Mansour Moufid
Mansour Moufid

Posted on

Make a macOS app icon from an image

macOS has everything you need to make an icon file for your application from the terminal.

macOS application icons are really a bundle ("iconset") of images at various sizes (16Γ—16, 32Γ—32, 64Γ—64, ..., 1024Γ—1024).

First create a myicon.iconset directory containing your icon image at all the sizes needed using the sips command line tool:

sips -Z 16 myicon.png --out myicon/icon_16x16.png
sips -Z 32 myicon.png --out myicon/icon_16x16@2x.png
sips -Z 32 myicon.png --out myicon/icon_32x32.png
sips -Z 64 myicon.png --out myicon/icon_32x32@2x.png
...
Enter fullscreen mode Exit fullscreen mode

Then bundle them together with the iconutil command:

iconutil -c icns myicon.iconset
Enter fullscreen mode Exit fullscreen mode

Here is a Makefile to do this automatically. Just save the Makefile to a directory containing your icon image file; change the variables NAME and ICON at the top; type make in the Terminal, and you're done: https://gist.github.com/eliteraspberries/a536f28b0498ec844fb210bb597738e2

Top comments (0)