Customizing the appearance of files and folders in OS X is a cinch. ⌘C, ⌘I, ⌘V, punctuated by a few mouse clicks.
Actually, that's total bullshit.
Sure, in the simplest of cases the copy and paste approach gets the job done, assuming one knows to copy from Preview.app if copying from the original source fails. As soon as one decides to do something a bit more advanced, such as providing versions for display at different sizes, one's shit outta luck.
Creating .icns and applying them to files, folders, or bundles
Create icon versions at one or more of the following sizes: 16, 32, 128, 256, and 512. (I've created two very different images for this tutorial.)
Save the images in a lossless format such as PNG. (If saving from Photoshop, make sure to use Save for Web & Devices. Icon Composer doesn't like PNG files generated via Photoshop's Save / Save As.)
Open Icon Composer, located in /Developer/Applications/Utilities. This is part of the Apple Developer Tools, which are free to download from Apple. If you're bandwidth-conscious you can dig out your Mac OS X installation DVD to save yourself a few GBs.
- Icon Composer interface
Copy and paste the various versions into their respective slots. (The foolproof way to copy an icon is to open it in Preview, ⌘A to select, then ⌘C to copy.)
Save the Icon Composer file. This'll create a single .icns file containing all the different versions you included.
The final step is to apply attach the .icns file as metadata to the file, folder, or bundle of interest. There are a plethora of apps which provide this functionality via attractive GUIs, but one shouldn't need third-party software to change the appearance of a folder!
I scoured the Web for a way to edit this metadata directly. I failed to find one, but came across the next best thing: a shell script written and kindly shared by Damien Bobillot. Download setfileicon.gz then crack open Terminal.app, located in /Applications/Utilities.
In Terminal, navigate to your Downloads folder (or wherever you saved the script).
$ cd ~/Downloads $ ls
lscommand to inspect the contents of the directory. If you used Safari to download the script, you should see a file named
setfileicon. If you used another browser you'll likely see
setfileicon.gz; unzip it by double-clicking the file in Finder.
Make the script executable and move it to your /bin directory so that it can be run from any directory (you'll be asked to enter your password).
$ chmod 555 setfileicon $ sudo mv setfileicon /bin/setfileicon
Finally, run the script passing in two arguments: the path to the .icns file; and the path to the file, folder, or bundle to which you'd like to attach the icons.
$ setfileicon ~/icons.icns ~/example
I agree. It shouldn't be this difficult. At least I've now documented the convoluted process. :s
- Icons in situ (note the 16x16 icon in the sidebar)