Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enable 'Open With for all' to work for some apps Apps
I am always editing small xml files and like to use Xcode to do so. However, Finder wouldn't allow me to set Xcode as the default app to open all files of type .xml. I would try and set it (using Get Info, change all) but it would always slip back and try to use Pages to open the file (which it couldn't do in the first place). Having had enough of this, I discovered that if you modify Xcode's info.plist file to include the file type, then restart the Launch Services, you can set the default app to Xcode.

The info.plist file of an app lets the Finder know various things about that app, including what file types it can open. Xcode doesn't tell the finder that it can open xml files, but in reality it can. So we'll modify the info.plist file to tell Finder that Xcode really can open xml files; and then we'll restart the launch services so it picks up on the modified info.plist file.

Read on for the detailed solution.

Find Xcode (or your app of choice) and control-click or right-click on the application and select Show Package Contents from the pop-up menu. This will open up a new window with a folder in it that says Contents; open that. Now you see several items, including our goal: the info.plist file. First make a copy of it, in case you botch something up. Then, just open the original with Property List Editor, the default app. You'll see a simple window with a collapsed tree, the first node of which is Root. Click on the triangle and expand the Root node. Expand the CFBundleDocumentTypes node. You'll see a bunch of numbered entries. Try expanding entry six -- on my version of Xcode, this node announces the ability of Xcode to open rtf files. This will be your guide; what we're going to do is basically duplicate this node, but specifically for xml files.

So, first, collapse node six again. With it still highlighted (but collapsed), the leftmost button on top of the window should say New Sibling (if the node is expanded, it will instead say New Child, which isn't what we want yet). Click New Sibling and a new node, node seven, will appear.

Change the class of the new node (seven) to Dictionary and then expand it. Expand node six again for guidance, then select node seven and click New Child. Name the new item CFBundleTypeExtensions just like our model node six. Select the class as Array. Expand this array and click New Child. The class should be set as String and for the value, type in xml. Now collapse the CFBundleTypeExtensions array and click on New Sibling. Name it CFBundleTypeName, set its class to String, and set its value to XML File.

Click on New Sibling again, and name this new sibling CFBundleTypeRole, set its class to String, set its value to Editor. Finally, though I'm not sure if this matters, add one more sibling and name it NSDocumentClass, set its class to String, and set its value to PBXRTFFileDocument. Save your work.

Now open Terminal (I think there are other ways of doing this, but this isn't too hard) and type:
Support/lsregister -f -domain local -domain system -domain user
This forces lsregister to update itself. I know there's a way to have it update only one application, but that didn't work for me. Perhaps someone can provide those details. Now, that should be it. Get Info on an xml file and you should be able to set the Open With app to Xcode as default, and then select Change All so that ALL xml files will be opened by Xcode. Finally!

[robg adds: This hint from 2005 contains a different solution to the same problem. I haven't tested this one, but as some comments to the prior hint indicated that it didn't work, I thought it worth sharing this potential solution.]
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)

Enable 'Open With for all' to work for some apps | 3 comments | Create New Account
Click here to return to the 'Enable 'Open With for all' to work for some apps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: Enable 'Open With for all' to work for some apps
Authored by: Uncle Asad on Oct 17, '07 03:03:36PM

You should just be able to put /unix/path/to/the/app/to/ after -f (and skip the rest of the stuff). That's always worked for me.

Alternatively, simply moving an app from the Applications folder or subfolder to another location and then moving it back should cause LaunchServices to pick up any Info.plist updates.

I often use the "move and move back" method when I'm making a single, known change, but for serious hacking/trial-and-error, I have an AppleScript droplet that wraps the command line, as "move and move back" gets old pretty quickly ;)

[ Reply to This | # ]
Enable 'Open With for all' to work for some apps
Authored by: bethri on Oct 17, '07 05:24:13PM
Will RC Default App not do this?

[ Reply to This | # ]
Enable 'Open With for all' to work for some apps
Authored by: koelling on Oct 20, '07 11:59:18AM
It's really silly that you have to go through all this effort just to get xcode to do what it already can do. Be sure to file a bug report at

[ Reply to This | # ]