Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In Finder.app, you can hit Enter to edit the name of the currently selected file or folder.

OS X will automatically select only the file name part, not the extension:

This is very useful, because that way you can just start typing the new name, without worrying about accidentally changing the file extension.

However, this only seems to work for “known” file types. If you try it with an unknown extension, the whole file name (including the extension) gets selected:

I tried mapping an application that can open all .bar files via +I → “Change All”, but I still get the behavior described above.

Where is the list of “known” file types stored? Is there a way to make OS X recognize new file types?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

This SuperUser post worked for me:

You need to browse to the application that you’d like to use to open these files, and edit its bundle. Right-click the application to handle these file extensions and select Show Package Contents. Navigate to Contents, and edit Info.plist. You might need Property List Editor, which is part of Apple’s developer tools. If you’re lucky, it’s in XML format. Edit this file’s CFBundleDocumentTypes and add an entry for the extension that you want.

I used TextEdit as the default application to open .bar files. The only thing I did differently was change the XML that went in TextEdit’s Info.plist to:

    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>bar</string>
        </array>
        <key>CFBundleTypeIconFile</key>
        <string>BarDocument</string>
        <key>CFBundleTypeName</key>
        <string>Bar Document</string>
        <key>CFBundleTypeRole</key>
        <string>Document</string>
    </dict>

…and then I used LSRefresh.app to refresh TextEdit in the launch services database. Then it worked as you suggested, although it will probably break the code signature of Textedit (and any other signed application) on Lion.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.