Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to make an application, say VLC, the default player for all the file types it supports, without going through all of them individually.

I might not even know what all the supported formats are (as VLC can read 100s of formats) and still want to set it as the default player for all of them.

I was able to do this using the terminal, with the procedure posted below.

Is there an easier way to do it that doesn't require the user to be a developer?

share|improve this question
1  
Are you asking specifically for the case where you have a list of file types, rather than the files themselves? For individual file types, you can select a file of that type, type command-i (get info), and in the file's info window, you can select the application to be used on all files of that type. –  Tim B May 25 '13 at 11:48
    
This question may be a duplicate of one or more of the following: How can I manually change default applications in OS X? (2011-10-23); How to Change File Type Associations? (2012-03-23); Setting “open with” default app forever (20-13-04-06) –  Graham Perrin May 25 '13 at 16:35
    
@TimB The title says it really, I don't want to do it for each file type individually. I might not even know what all the supported types are. I just added "all" to the title to make it more clear. –  Tobia May 25 '13 at 17:56
    
@GrahamPerrin No, it's not a duplicate of any of them. –  Tobia May 25 '13 at 17:57
    
The Original question from you was how to make VLC default player for your parents for easy use to play common formats with one click. When you change your question as significantly as you did, it is better to make it a new question to avoid confusion in answers. –  Buscar웃 May 26 '13 at 11:48

3 Answers 3

up vote 2 down vote accepted

While RCDefaultApp is a bit old, it still works

This gives you a decent GUI interface to control default apps

share|improve this answer
    
This is nice, but it would still makes me go through 100+ clicks to set VLC as the default player for all media files. –  Tobia May 25 '13 at 18:06
    
No it doesn't? System Pref -> RCDefaultApp -> Apps -> VLC. Then click on the check box for the whole 'Extension' section and click 'set as default'. –  demure May 25 '13 at 18:12
    
I stand corrected. Answer accepted, thanks! –  Tobia May 25 '13 at 18:19
  1. Find the application's Info.plist file and convert it to xml format if needed.
    VLC's plist file is already in xml format, otherwise you'd have to do:
    plutil -convert xml1 /Applications/VLC.app/Contents/Info.plist
  2. Perform the necessary dark magic to extract the list of supported file extensions, with your preferred wand (here is awk, but sed, perl, and others would work just as well):
    awk '/CFBundleTypeExtensions/{t=1} /<\/array>/{t=0} t&&/<string>/{gsub(/\t*<\/?string>/,"");print}' /Applications/VLC.app/Contents/Info.plist
  3. Check the output to make sure you really got the list of extensions and that you really want to associate all those types with the app.
  4. Recall the last command and edit it in order to create an empty file in your current directory for every file extension in the list:
    for i in $( ≪awk command as before≫ ); do touch dummy.$i; done
  5. Open your home folder in the Finder, select all the "dummy" files and open a collective inspector for all of them: option+command+i
  6. Set the application in Open With and use the Change All button.
  7. Trash the dummy files.
share|improve this answer
    
Let me get that? you want to set the VLC as default player! –  Buscar웃 May 25 '13 at 12:03

I wouldn't want to associate VLC with all types it supports (like mp3, iso, or utf), but I have added this to a duti configuration file:

org.videolan.vlc .avi all
org.videolan.vlc .flac all
org.videolan.vlc .flv all
org.videolan.vlc .mkv all
org.videolan.vlc .mov all
org.videolan.vlc .mp4 all
org.videolan.vlc .mpg all
org.videolan.vlc .wmv all

duti converts extensions that are listed in UTI declarations to UTIs automatically, so you can specify the types like .jpg instead of public.jpeg. See com.apple.LaunchServices.plist. The UTIs of some extensions like .mkv depend on what applications were installed first.

Many applications only list UTIs (LSItemContentTypes) and not extensions (CFBundleTypeExtensions) in the Info.plist. This would list the UTIs and print extensions associated with them:

dump=$(/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump); plutil -convert xml1 /Applications/TextEdit.app/Contents/Info.plist -o - | sed -n '/LSItemContentTypes/,/\/array/p' | sed -En 's|.*string>(.*)</string.*|\1|p' | while read u; do awk "/uti: *$u/,/tags:/" <<< "$dump"; done | sed -En 's/[[:space:]]*tags: *(.+)/\1/p' | sed $'s/, /\\\n/g' | grep '^\.' | sort -u

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.