Add an application to Mac's "open with..." menu

...without changing the default application. In this case, I wanted .pde files to be able to be opened in either processing or arduino.

mac osx,terminal,processing,arduino

In the newest version of Arduino (v2) - sketches have their own extension (.ino). However, in older versions of arduino, sketches were saved with the extension .pde, which is shared by Processing sketches. In mac, if you want to open a .pde file in Arduino without changing the default for all Processing files, you have to right click, choose open with > other > and scroll through the subsequent window to find the application you want to open the file with. So how to get it on the context menu that shows up when you right click, without changing the default? Go through this process once, then you'll never have to deal with it again. And this will work for any application, not just Arduino:

Go to applications in the finder window, and find the application you want to add as an option. In my case, I find the icon for Arduino. Then right click and choose Show Package Contents. Inside that window is an Info.plist file. Open that up in a text editor, and search for the following:


<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>[extension name here]</string>
    </array>
</dict>

and add the extension you want this program to be able to open. So for me, it looks like this:


<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>ino</string>
        <string>pde</string>
    </array>
</dict>

Save that file, make sure the application icon is selected in the finder, then go to the Terminal (Applications > Terminal) and enter the following:

touch /Applications/Arduino.app 

deselect, then reselect the icon, and now you should be able to right click and choose open with > Arduino. If you don't see this option, go back to terminal and enter:

killall finder