• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Changing Icons > Changing Icons

4.4. Changing Icons

Each time you restart your computer—and each time you log out and back in—the Finder launches, and as it starts, it reestablishes icon associations.

The Finder scans your disk and, when needed, creates an updated icon registry. You've already seen this registry in action, earlier in this chapter. It helps the Finder assign icons by mapping a file's extension and creator code to an icon. But the story doesn't end there. Although Finder sets the default look of each icon, you can override this behavior on a file-by-file (or folder-by-folder) basis and add a custom icon to any file, folder, or bundle you choose.


For working through the examples in this section, you'll need the following applications:

  • Finder (/Applications/Utilities)

  • Terminal (/Applications/Utilities)

  • The SetFile command

The most common method of changing Mac OS X icons has its roots in past operating systems. If you knew how to copy and paste icons in Mac OS 7 (or 8 or 9), the same method carries over into Mac OS X. This method does not change the core file or folder type, or even its default icon. It merely pastes a new icon on top of the old one. This icon persists until it's changed—by a program, by a system update, or by you. The following steps walk you through the process of finding, copying, and pasting an icon. The secret here involves reusing an existing icon.

  1. In the Finder, select a file or folder with an intriguing icon. Choose File → Get Info (-I). An Info window opens, showing the current icon at the top-left, next to the file or folder name.

  2. Click on the image of the icon to select it; you'll know the icon is selected when a blue outline appears around it. Choose Edit → Copy (-C), and then close the Info window (-W).

  3. Select the file you want to paste the icon onto. Choose File → Get Info (-I) to open an Info window for this second file.

  4. Select the icon at the top of the window.

  5. Select Edit → Paste (-V). The copied icon replaces the original.

  6. Close the Info window with -W.

You can easily restore the default icon at any time. Just select the icon at the top of the Get Info window and press the Delete key. This removes the pasted icon from the file and restores its original icon.

The SetFile command, which is part of the Xcode Tools distribution, offers a powerful way to hide or show custom and default icons. Its attribute flag (-a) allows you to toggle the custom icon flag for files and folders. To enable custom icons, use the C option (uppercase). To hide custom icons, use c (lowercase) instead.

$SetFile–a C foo.tiff
$SetFile–a c foo.tiff

These methods change a file or folder only on the surface. To change the default icon, you've got to dig a little deeper. The next sections will show you how to customize icons at their core.

4.4.1. Updating application icons

An application's icon greets you from the Applications folder and from the Dock. These icons have been carefully designed so you can quickly identify the icon with the application and its function. Best of all, you can mess with the icons as much as you like without affecting how the application itself works. Figure 4-11 shows just one possibility; in it, iPhoto's icon appears both in its default form and in a user-customized version.


For working through the examples in this section, you'll need the following application:

  • TextEdit (/Applications)

Figure 4-11. Update application icons to create a new, creative, or personalized touch

You can customize application icons just as you would customize sounds or embedded images. Just swap in a new icon file and you're set. In the following steps, you'll see how to locate the proper file and update it to create a new look for an application.

  1. In the Applications folder, select an application you want to work with. Control-click (right-click) the icon and select Show Package Contents from the pop-up. Navigate into the Contents folder.

  2. Control-click (right-click) on the Info.plist file and select Open With → Other. A window labeled Choose Application appears, taking you to the Applications folder; scroll down and select TextEdit and then click on the Open button.

  3. One of the jobs of an application's Info.plist file is to associate its application with a .icns file. In TextEdit, search for CFBundleIconFile. This is a key. Its value, a string, provides the filename for the application's icon. For example, in iPhoto's Info.plist file, you'll find the following lines:


    These lines tell you that iPhoto's icon is stored in Contents/Resources/NSApplicationIcon.icns.

    Don't be fooled by the nice use and generic sound of NSApplicationIcon. Although it's an elegant touch by the developers (at least in my opinion), icon names are arbitrary. They range from MacIE.icns (Internet Explorer) to app.icns (Mail) to QuickTime Player.icns (QuickTime, which includes a fascinating and irritating space between the words QuickTime and Player).

  4. Go back to the Finder, open the Resources folder, and then find the .icns file identified by the Info.plist file. Click once on the icon file and select File → Duplicate (-D) to make a backup copy of the file.

    Adding Thumbnail Icons to Files

    Want a quick way to make an icon you can copy from any image file? Just open it in Photoshop or Photoshop Elements and Save As. The program automatically adds a miniature version of your image to the saved file as a custom icon.

    If you're looking for a more automated solution, consider AppleScript's folder actions. Panther's new Folder Action scripts allow you to create folders that process files dropped into it, adding image thumbnails. Here's how:

    1. Create a new folder on your Desktop. Call it AutoThumbnail.

    2. Open the AppleScript folder in the /Applications directory. Locate Folder Actions Setup and double-click it. The Folder Actions Setup window appears.

    3. Check Enable Folder Actions. This globally permits folders to perform attached actions.

    4. Click the plus (+) button at the lower-left of the Folder Actions Setup window. A file browser appears.

    5. Navigate to the Desktop and select AutoThumbnail. Click Open. A dialog appears, asking you to choose a script to attach to this folder.

    6. Select Image → Add Icon.scpt. Click Attach. The new action appears in the right-hand column.

    7. Quit Folder Actions Setup (-Q).

    8. Return to the Desktop. Locate an image file without a custom icon and drop it into the AutoThumbnail folder. The new script automatically executes, adding an icon to your file. As it does, it moves the file from the top level of AutoThumbnail into an Original Images subfolder, where you can recover your updated file.

  5. Use the directions from earlier in this chapter to create an entirely new icon file or update the existing one. Use Icon Composer or another icon utility to change the look of your application. When you're satisfied with your edits, replace the application's .icns file with the new version.

  6. Save any work in progress on your computer and log out of your account. When you log back in, the Finder reloads all its icon associations and updates the application icon with your changes.

You can use this same method, more or less, to change the document icons defined in an application's Info.plist, but as the next sections show, this process is a little trickier.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint