I found myself being annoyed by the fact that .doc files written by TextEdit.app had a generic, blank file icon. If you feel the same way, try this. Make a custom .icns format icon and place it in /Applications -> TextEdit.app -> Contents -> Resources. Open the file /Applications -> TextEdit.app -> Contents -> Info.plist in your favorite text editor. To the
<dict> tag pertaining to Microsoft Word Documents, add the following:
<key>CFBundleTypeIconFile</key>
<string>word.icns</string>
The name of your custom icon should be used where it says
word.icns. Now update the launch services database with the command:
/System/Library/Frameworks/ApplicationServices.framework/Versions\
/A/Frameworks/LaunchServices.framework/Versions/A/Support/\
lsregister -v -f /Applications/TextEdit.app/
By extension (no pun intended), you can use this to assign a custom icon and default application for any file extension or pre-OS X file 'type' by adding a new
<dict> entry with appropriate keys (see below) in the application's Info.plist file:
- CFBundleTypeExtensions - Extensions for this file type
- CFBundleTypeOSTypes - OSTypes for this file type
- CFBundleTypeIconFile - Resource ID for the icon for this file type
- CFBundleTypeName - User visible name for this file type, i.e., the kind string used by the Finder and others.
- CFBundleTypeRole - Role of the application for this file type (Editor/Viewer)
- LSTypeIsPackage - This document type is a package, whether defined by a CFBundleOSType or CFBundleFileExtension
The key descriptions above are from
this Apple TechNote.