How can I add a new application to the Open With menu?

How can I add an application to the Open With menu (shown after right-clicking) for a given file type, without making that file always open with that application?

In this specific instance, I'd like to the option to open an Web site location (.URL) file with TextEdit, while still defaulting to Safari.

I'm running OS 10.7.4.


Solution 1:

  1. Add this to the CFBundleDocumentTypes array in /Applications/TextEdit.app/Contents/Info.plist:

    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>url</string>
        </array>
    </dict>
    
  2. /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/TextEdit.app/

  3. killall Finder
  4. Change the default application back to Safari in Finder

If the application is signed, modifying an Info.plist invalidates the code signature. It also makes a few applications like TextEdit and WriteRoom crash on launch on 10.8.

Solution 2:

Try selecting the file in the Finder and doing File > Get Info. From there you should be able to choose any application to open it with. Once you've opened that type of file in that application once, it should start appearing in the Open With menu.

EDIT: The answer above does not work. Alternate suggestion:

I felt bad that my prev answer was incorrect, so I googled around. I found this tip from Mac OS X Hints:

  • Control-click (or right-click) the app in question and select "Show Package Contents"
  • Open the Contents folder in the app bundle. There you'll find a file called Info.plist. This is an XML property list that stores all sorts of information about the app.
  • Open the file with your favourite text editor. I recommend Hydra, but TextEdit will do just fine.
  • Search for something that looks like the following:

    <key>CFBundleTypeExtensions</key>
    <array>
        <string>txt</string>
        <string>srt</string>
        <string>suffix1</string>
        <string>suffix2</string>
        …
    

    and so forth, with the suffices the app is able to open contained within the tags. Then you simply delete [or add --newtron] the suffix for items you don't want [or want] the app to open.

  • Save the file, and close it (or quit the editor).

Solution 3:

newtron's second solution worked for me but only after I opened Terminal and executed the following command:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

After restarting the system the desired app was in my "open with" context menu.

Thanks

Solution 4:

Instead of opening the file with the context menu, you can also drag any file to any desired application while pressing + keys. This will force any app to try even if it thinks it can't do so. I use this all the time.

Solution 5:

You can add the option as a Service with Automator and then trigger it with a Hotkey from Keyboard Maestro.

  1. Open Automator and select Service document type.
  2. Select Files and Folders in the top Service receives selected menu
  3. Search for and select the Open Finder Items action.
  4. Now select TextEdit in Open with:
  5. Save the service with a name you want to see in the menus

You can now find this by:

  • Right-clicking the file > Services

enter image description here

OR

  • Finder Menu > Services (with a file selected)

enter image description here

But you don't have to stop there!

I then made a Keyboard Maestro macro so I can just use a Hotkey to do it: enter image description here

I got this idea from this site: http://www.mactricksandtips.com/2013/05/add-open-with-textedit-or-any-other-app-to-right-click-menu-item.html