9

I have some files with extension "module" and "inc," which are PHP files. When I try to open them, the list of applications that can open them shows only the application I have set as default application, even though there is another text editor that can open PHP files, and for which I have set the files with those extensions to be highlighted as PHP files are.

screenshot

If I open the "Get Info" dialog, select another application in "Open With," and then click on "Change All..." what I get is the following.

screenshot

screenshot

What I want to obtain is what shown in the following screenshot, which shows the "Open With" menu for another type of file:

screenshot

Is there a way to associate those extensions to the content type used for PHP files?
Alternatively, how can I show, in the list of the applications shown under the "Open With" menu, all the applications that can open PHP files, when Finder doesn't do that already?

I will explain what I want to obtain using a screenshot of RCDefaultApp.

screenshot

A file using "module" as extension is a PHP file, in my case (it is a Drupal module); what I want is adding that extension to the ones reported for the "public.php-script" UTI.

2
  • I am eager to know this as well - the closest I've gotten asking about UTI and Launch Services on SuperUser...
    – bmike
    Commented Sep 7, 2011 at 13:46
  • I think that using RCDefaultApp as Kungi answered is the way. But if you think that that particular extension(s) should be mapped to these content types, you could consider writing to the app makers to propose including that.
    – Agos
    Commented Sep 11, 2011 at 10:21

3 Answers 3

3
+50

There is not a safe and advisable way to achieve what you are after because this function of the OS is controlled by the Launch Services database. Developers register the filetypes their applications support with the OS on first launch.

The best way to get this fixed is to petition the developer to add support for the file extension in a future version of their application.

With that said you have already found the only documented way that Apple offers for overriding the edicts of the Launch Services database. If you want to dig deeper and take the road less traveled supported here are a few pointers.

There is a .plist file that governs part of what Launch Services does located at: ~/Library/Preferences/com.apple.LaunchServices.plist

Apple notes that removing this plist can clear out unwanted Open With contextual menu options. But that's the opposite of what you're after.

It's a binary .plist but you could convert it to an xml version and experiment a little to see if you can come up with a recipe to achieve what you're after. This isn't advisable, it could cause harm, and it will most likely get overwritten by the OS at some point.

There is also a tool hidden a bit deeper in the OS called lsregister which could be helpful in exploring Launch Services's plumbing. Here is a helpful explanation of lsregister and its options.

3

The Alternative to the Solution mentioned by Gerry is the RCDefaultApp Preference Pane. It's free and let's you set all Application->Content Type, Application->URL connection on your System.

In the "Apps" Pane of RCDefaultApp you can set what file Types a specific Applications Supports when you check "php" with your Editor it will also show in the "Open With" Menu.

3
  • It doesn't allow to add an extension to the ones associated with a UTI or a content type. It allows to change the default application that opens files, which is essentially what Finder already permits; the difference is that with RCDefaultApp you change it from the same place (the preference panel).
    – avpaderno
    Commented Sep 11, 2011 at 12:26
  • @ kiamlaluno - but you can create a new module extension and then associate it with your app. Or what is the problem with this ?? Commented Sep 11, 2011 at 14:40
  • The problem is not associating an extension with an application, which would become the default application for that extension; the problem is to automatically have the list of applications in "Open With" pre-populated. If you see the third screenshot I used in the question, Xcode, Dashcode, and Console are shown for the ".inc" extension, but I have not associated those applications with the extension.
    – avpaderno
    Commented Sep 12, 2011 at 9:37
0

In the context menu, choose Get Info, select the program to use in the "Open with:" pane, and click "Change all..."

1
  • 2
    I tried this, but the only effect is changing the default application for those files, while I want to keep the default application, but showing another application in the list of the applications shown in the "Open With" submenu.
    – avpaderno
    Commented Sep 7, 2011 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .