Prevent changing default app for some file extensions
Is there anyway to prevent that whatever app change the default app for some kind of files?
As an example, my default app for movies (mp4
, mkv
, avi
, ...) is VLC, and I don't want this to be changed for whatever reasons.
Solution 1:
I'm using OS X 10.10.1.
The file that stores the "Open With" data seems to be ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.secure.plist
Assuming you've setup all of your apps' "Open With" settings, you can ensure that they're not permanently overwritten by removing write permissions from the above file:
chmod 444 ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.secure.plist
It kind of works.
I tested this using a .docx file. I set my "Open With" preference to Pages.app and then removed the write permission of the LaunchServices plist file. I found that despite changing the permissions of the preference file, I was still able to change the .docx's "Open With" preference to Microsoft Word. However, after restarting the machine the setting was reverted to the one in the "com.apple.LaunchServices.secure.plist" file as it couldn't write the new data to the file.
I assume OS X stores in memory the "Open With" information if it can't write to the LaunchServices file, which is lost after a restart.
Not a great solution and I hope there's a better one, but it's a start.
You can revert the change by running this command:
chmod 644 ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.secure.plist