I've been doing more OS X development recently, and coming from the iOS world, there's a lot that's familiar but I still stumble over many things. Creating an app icon is one of them. After some poking around, I've discovered what you need to do to create a custom icon for your modern Mac app.
Step 1: Create the icon images
Modern Mac icons pack five different resolutions in one
.icnsfile, from 16x16 to 512x512:
@2x" added to the base filename, so in addition to the five standard resolution icon images, you now need five double resolution ones:
email@example.com 32 by 32 pixels and
firstname.lastname@example.org 1024 by 1024 pixels. Some of these images have equivalent pixel sizes:
email@example.com both 32 by 32 pixels. You may be able to get away with using the same bitmap in many cases, but you (or your icon designer) may want to tweak each version to look best on their respective display types.
Step 2: Add an
.iconsetto the Xcode project
In the olden days, you would use the Icon Composer app to build your
.icnsfile, but it's no longer being updated by Apple and doesn't support double resolution images. Today, Xcode will build your
.icnsfile automatically for you. (Alternately you can use the
iconutilcommand line utility to build
.icnswith high res images or to extract images from
.icnsfiles; see Apple's High Resolution Guidelines for OS X for details.)
The trick to making Xcode build your
.icnsautomatically is to put your set of icon images in a folder named
<ICON_NAME>becomes the base name for your
.icnsfile. Add this folder to your Xcode project and Xcode will then create
<ICON_NAME>.icnswhen you build, and automatically copy it to your app bundle.
Note that the images in the
.iconsetdirectory need to have the names given above: "
icon_16x16.png" through "
firstname.lastname@example.org" or you will see a warning in Xcode when building your project and the mis-named images won't be included.
Step 3: Add the icon to the Info.plist
To set your app's main icon, add the "Icon File" key to your app's
Info.plistfile and set the value to
.icnsextension). If you used the standard Xcode template to create your app, your
Info.plistwill be named "
<APP_NAME>is your app or project name. For those of you who like to edit your
.plistfiles as XML, the key name is
You can also drag the
.iconsetdirectory from the finder or the Xcode project navigator to the "App Icon" pane of the Summary tab for your app's target (pictured above). If you use this approach, Xcode will insist on copying the
.iconsetinto the root folder of your project, even if you've already added the
.iconsetsomewhere else in your project's directory tree (<sarcasm>another great example of Apple's attention to detail</sarcasm>.) If you're not fussy about your project organization, you can simply let Xcode have its way; otherwise you can remove the copy Xcode makes and add the
.iconsetin a more appropriate place, like the
Resourcesfolder; just make sure to leave the "Icon File" key in your
Info.plistand Xcode will show the icon in the "App Icon" pane.
Easy as 1-2-3
Not hard once you figure it out, and a nicer workflow than having to wrestle with a half-baked special purpose app like Icon Composer.