I want to change my default media player in macOS.

(In my case, I want to change it to my own AppleScript-created instance of VLC that I exported as ‘VLC-New-Window.app’, which is scripted to always open files in a new VLC instance so that it doesn’t override the existing paused playlist or video file I want to keep in the background.)

It is very tedious to find an example of every file type I use VLC for (whether mkv, avi, mp4, m4v, m4a, m4b, mp3, flac, or m2ts), right-click on it, and manually set the new default program each time.

And honestly I’d like every audio or video file type that VLC can open to be applied here so that I never have to worry about this again.

Is there any method that can help automate this, or do this in batch?


Step 1: Put the list of file types (from one of the categories below) into a text file at ~/types.txt, with one per line as shown.

Below are very exhaustive lists for three common media file categories.





(For the few file extensions that I'm aware can apply to either video or audio, e.g. .ram, .mp4, .3gp, .3g2, I've put such an extension into the video list).



(The above lists were collated from sources including dotwhat.net as at 2020.09.30 (audio, video, image), VLC's formats wiki, foobar2000 documentation, my own knowledge, and various programs' save / export file dialogues. From such sources, I removed a few that I deemed unsuitable as they are commonly used in non-media file contexts and may conflict, e.g. .xz was in a dotwhat.net media list, but it's usually an archive format.)

Some extensions may not open in the universal media player / image viewer you want to switch to, but you can fix it on a doesn't-work basis after the switch.

Step 2: Create temporary dummy files of every extension in an above category in your user folder.

Open Terminal.app, and using your txt file above do the following command:

while read -r line ; do mkfile 1b file${line} ; done < types.txt

Step 3: Select all dummy files in Finder at once, then press option+command+I. Under 'Open With', select the program you want to change the default to, make sure to click on 'Change All...' button, confirm, and it is done.

  • 2
    Where there’s a will, there’s a way. +1 for gumption
    – bmike
    Apr 12 '18 at 0:31
  • 1
    If you save the lines in Step 1 into a text file "types.txt" then while read -r line ; do mkfile 1b file${line} ; done < types.txt will create your files for you. Apr 12 '18 at 4:48
  • 1
    I believe that it is possible to change file association for each file using a script at stackoverflow.com/a/2976711/13044086 By combining these two scripts it should be possible to change all file associations with a single command. Sep 25 '20 at 12:38
  • Note: there's more image formats to add referenced in lemkesoft.info/files/manuals_gc11/Manual_GC11_EN.pdf (e.g. .422) (not an easy task as most don't list the file extension) - I aim to make this quite a complete resource.
    – user163629
    Oct 3 '20 at 4:13

You must log in to answer this question.