I have associated a special file type with my application according to document Type method see How do I associate file types with an iPhone application?. It works, however, when I changed the application and installed it again. When I double-click the document and it seems that it still triggered the old one!. How to change this?
-
For anyone still interested, I would recommend to take a look at https://developer.apple.com/library/prerelease/mac/documentation/Carbon/Reference/LaunchServicesReference/ – Mugen Aug 27 '15 at 06:47
2 Answers
You should be able to select the file, and get info on it, and there should be an "Open With" option and you can tell the Mac to open it with a certain application. And then there's a button to "Change All" meaning make all of those file types open with that application. Hope that helps!

- 3,484
- 4
- 26
- 35
-
Thanks so quick response, I know this way, but I what to change it automatically. For example, I have released my application to customer, and I don't want to bother customer to do it manually. it's too hassle. What I am curious is that I have replaced the original application and when I double click the file, it still triggers the old one?! – Jet Nov 06 '13 at 10:33
-
Ah, yeah... I don't know how to change it automatically on someone else's computer, sorry. – Dan Goodspeed Nov 06 '13 at 10:41
-
-
I had incorrectly assumed that *this* would work (and it doesn't): CTRL-click the file, "Open With" > Other > find the file > choose the program > choose "Always Open With". http://www.dummies.com/how-to/content/how-to-assign-a-file-type-to-an-application-in-mac.html helped me see what you were saying, which is to choose "Get Info" first. – Ryan Sep 02 '14 at 16:48
The Launch Services Programming Guide would have all the details about it.
For an example, you could have a look at how the open source duti utility does it.
It can also be done with a shell command:
defaults write com.apple.LaunchServices LSHandlers -array-add \
'{ LSHandlerContentType = "public.plain-text"; LSHandlerRoleAll = "com.apple.TextEdit"; }'
Then it needs a reboot to take effect. Or a restart of LaunchServices:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
(You may have come across suggestions to use lsregister -kill -seed
to have it take effect immediately, but that will make OS X show warnings again about opening some applications for the first time)
This answer on apple.stackexchange shows how to use mdls
to find the BundleIdentifier and ContentType you need for the command-line approach.