how to change "open with" defaults via command line?!?

folks,

i know that if i get info on a file -- in this case, a filemaker 5.5 file -- i can choose the default "open with" settings and apply those settings to all files of that kind. see the attached image for what i mean.

but how do i do that via the command line?

thus far, here's what i've got: i know that i can open a document called "scrubbing shell.sh" on my desktop WITH either MS Word of TextEdit by calling:

open -a textedit /Users/david/Desktop/scrubbing-shell.sh

or

open -a Microsoft\ Word /Users/david/Desktop/scrubbing-shell.sh

no sweat. BUT....how do i set the defaults so that it ALWAYS opens with that app in the future when double-clicking via the GUI?

many thanks, ya'll!

david koff
associate systems admin
the j. paul getty trust
dkoff AT getty DOT edu

macbook pro intel 2 dual core, Mac OS X (10.4.9)

Posted on Apr 26, 2007 2:28 PM

Reply
17 replies

May 4, 2007 4:44 AM in response to the razor

Hi David,
This is a discussion of the command line, which is a textual interface with the computer and as such lends itself well to posting information on the web. It is a simple matter to copy-and-paste commands and output from the Terminal into the browser. This makes possible they conveyance of huge amounts of information in a single post.

One the other hand, you've chosen to limit the information in your post to two items, limiting one severely and contradicting the other. Your description of the order of operations in the sequence is fine but the operations themselves are missing so all I can tell you is that the order is correct.

You did post one bit of output and like much command output, it contains a wealth of information. That is "1,393c1,8", which says that one step in changing the first file to the second would be to delete the first 393 lines of the first file and replace them with the first 8 lines of the second. Now I don't know what is in the rest of the files but that says to me that these are pretty much completely different files. Of course without the command, I don't know which property list was first and which was second.

While I've never seen quite that rate of compression, I'm guessing that one of the files is in binary form. Of course you don't say which file you converted to XML but I would guess that you started out with a binary file, copied it to another binary file and then converted the original to XML. I'm sorry for not indicating that the process begins with a text file but I thought we were past that. I would expect "diff" to produce some useful output if you start with a text file.

BBEdit is as powerful as the command line for many tasks and in this case, possibly more powerful, as it can display a binary property list as text. That would prevent having to use plutil. However, I wouldn't trust a comparison by eye. In the search menu of BBEdit, there is a "Find Differences..." item. If you specify the original and copy com.apple.LaunchServices.plist, it will show you all of the differences in a nice side-by-side format. That's actually how I first found the change.

Of course maybe your property list doesn't actually change. To my knowledge, Apple hasn't documented this mechanism. No matter how much I've experimented, no one but an Apple employee could be said to be knowledgeable on the topic. It's certainly possible that your LaunchServices behaves completely differently from mine. It's just that I can't help in that case. Of course something keeps changing your property list to binary and that generally happens automatically when LaunchServices or the "defaults" command changes the property list. Thus, I still hold hope that you'll be able to find the change.
--
Gary
~~~~
All men know the utility of useful things;
but they do not know the utility of futility.
-- Chuang-tzu

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

how to change "open with" defaults via command line?!?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.