Search code examples
cocoansdocumentinfo-plist

Cocoa and executable files


Hey, I am writing a Cocoa app for Mac OS X and I want it to be able to open executable files. That is, files with the 'execute' permission. These files usually do not have a file extension, so I don't know how to specify this in the plist file.

How can I make the Open panel allow the user to select UNIX executables? Thanks in advance.


Note that I don't want to execute them.


Solution

  • To have your application listed in the "Open With..." panel of the Finder for unix -executable file, you have to update your Info.plist for CFBundleDocumentTypes with the following:

    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.unix-executable</string>
        </array>
    </dict>