6

How can I add a program to the "Open With" menu on a Mac?

Chris
  • 233

3 Answers3

4

Do you mean the submenu you get when right-clicking on a document? If so, it's generated automatically by Launch Services based on the document types your applications claim to be able to handle. If you look inside an application package (right-click the application, and select Show Package Contents), inside the Contents folder there'll be an Info.plist file with various information about the application, including an array of document types it can open (see Apple's dev documentation here).

TLDR; if the application handles that type of document, it should already be listed; if not, I don't know a way to add it manually.

1

If you open the "Get Info" window for a file type you're interested in modifying (control click + "Get Info" or ⌘ command + I while the file is selected), you can change the program to the one you want and click "Change All". I've found that this then modifies the "Open With" menu so that if you control click and go to "Open With" now it will show that application because it is the new default. The only downside is that you have to make it the default (I tried changing it back after this and it didn't stick).

It's not quite the perfect solution, but works well enough in my particular case and may be useful for others, and it should be easier / more stable than the plist solution.

Get Info screenshot

macOS High Sierra 10.13.5 (17F77)

shim
  • 133
  • 1
  • 9
1

If you've used Script Editor or Automator to make a droplet for an app, when you want the droplet added to the "Open With" list, you can do the following:

  1. As always, save a backup copy of any app/system files you're planning to modify! -- just in case anything goes wrong

  2. Copy the target file extension array from an app that is listed in the "Open With" list from the app's info.plist file, and paste it into the CFBundleDocumentTypes array in your target app's info.plist (right click on app, choose "Show Package Contents"). For this example, I'm showing the before/after of the VLC droplet.app info file after replacing the wildcard extension ("*") data with a few file types from the VLC.app info file:

"/Applications/VLC droplet.app/Contents/Info.plist":

Before:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>*</string>
        </array>
        <key>CFBundleTypeOSTypes</key>
        <array>
            <string>****</string>
        </array>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
    </dict>
</array>

AFTER:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFile</key>
        <string>aiff.icns</string>
        <key>CFBundleTypeName</key>
        <string>AIFF file</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.aiff-audio</string>
            <string>public.aifc-audio</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>divx</string>
        </array>
        <key>CFBundleTypeIconFile</key>
        <string>movie.icns</string>
        <key>CFBundleTypeName</key>
        <string>DivX file</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
    </dict>
    <dict>
        <key>CFBundleTypeIconFile</key>
        <string>m4v.icns</string>
        <key>CFBundleTypeName</key>
        <string>MPEG-4 File</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.mpeg-4-audio</string>
            <string>com.apple.m4v-video</string>
            <string>public.mpeg-4</string>
        </array>
    </dict>
</array>
  1. Open terminal, and enter the following command, changing <TARGET_APP> to the name of the app you are editing the info.plist for to add it to the "Open With" list:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f "/Applications/<TARGET_APP>.app/"

  1. Enter the command killall Finder to force restart 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.

NOTE: I grabbed some of the info for this answer and edited it to update it with a bit more detailed info/explanation. The original thread is located here.

MikMak
  • 2,169