Posted on 09-29-2011 12:32 AM
Hello!
I'm wondering if there's any way to change what application opens a given
type of file. In my specific case, I'd like to set either Adobe Reader or
Preview to open pdfs, instead of Adobe Acrobat.
So far as I can tell, this is controlled on a per-user basis in the
~/Library/Preference/com.apple.LaunchServices.plist file. I don't entirely
understand the structure of the file, but it looks as if the only way I can
think of doing this is writing a script that walks through the file, finds
the reference to pdf files, changes to Preview/Reader, or else failing to
find such a reference, adds it. Is there another, more elegant, way of
doing this?
--
George M. Casper
Tech Support Specialist
Bucknell University
"People believe any quote they read on the internet if it fits their
preconceived notions." - Benjamin Franklin
Posted on 09-29-2011 04:29 PM
I've spent a lot of time trying to do what you describe without consistent
success (e.g. I can get it working on a test machine, but not on multiple
machines). I think my coding skills are lacking!
But yes, you have to manipulate the LaunchServices plist (e.g. with
/usr/libexec/PlistBuddy) If anyone does have a handy script, I'd be
grateful as well.
Tatian
*Tatian Greenleaf*
*Associate Director of Technology
*::::::::::::::::::::::::::::::::::::::::::::::::
*Saint Mark's School
(415) 472-8000 x1014*
Posted on 09-29-2011 04:40 PM
Posted on 10-12-2011 08:23 AM
Thanks for the suggestion, Nate!
Unfortunately, I'm having some getting duti to run reliably. I've written a
small script that runs duti -x to get whatever application it's using, then
sets it to Preview, then runs -x again to verify, and writes all of this out
to a log file. Looking at the log file; everything looks precisely the way
you'd expect it should. However, if I run duti again at the command line
with -x, it acts as if it hasn't changed, and more distressingly, files
don't seem to recognize the change. I've attached the two scripts I've
written for this - is there anything obviously amiss that you can see?
Thanks for any light anyone can shed.
Posted on 10-12-2011 11:42 AM
those look simple enough. do you see the same results after a reboot?
the launchservices db tracks which apps handle what, so if it's still not working after you make the change, you can try killing and rebuilding the launchservices db.
some old notes are here: http://hints.macworld.com/article.php?story031215144430486
from what i've seen the few times i've used it as you're looking to do, i haven't always seen any difference in document icons, but pdfs did open in preview once set.
Posted on 10-26-2011 08:26 AM
(Sorry for the delay in responding; I've been working on this as a very
low-priority task, and have been busy recently)
So, I've figured out why I'm not seeing what I expect: duti *is* doing what
it's supposed to do, but, each file has it's own "bind this file to
application X" metadata, which overrides the UTI/extension information. I
found this out by looking at a few files using an old app called XRay.
I'm trying to figure out whether or not I can (and can do so quickly/safely)
change that metadata across the filesystem for all .pdf files, and changing
my scripts to do that at the same time I make the change in duti. Anyone
have any experience in doing that?