Duti - macOS Bulk File Association Tool
Duti developed by Andrew Mortensen is a very handy and easy to use tool. Its very useful to set up newly formatted systems. It sets the default Apps for specific extensions.
You can use duti by typing the proper arguments in a shell or the bulk way by reading the arguments from a plain text file or a xml file.
You can download duti's source code here: https://github.com/moretension/duti
Alternatively you can install it with Homebrew
brew install duti
The bulk way, with config file
Any filename will do for this file, duti.conf seems appropriated.
# BUNDLE ID UTI/EXT/MIME TYPE ROLE
# Text Editor - Sublime 3
com.sublimetext.3 .c all
com.sublimetext.3 .js all
com.sublimetext.3 .conf all
com.sublimetext.3 .cfg all
com.sublimetext.3 .ini all
com.sublimetext.3 .json all
com.sublimetext.3 .jsp all
com.sublimetext.3 .js all
com.sublimetext.3 .java all
com.sublimetext.3 .scss all
com.sublimetext.3 .css all
com.sublimetext.3 .sql all
com.sublimetext.3 .sqlite all
com.sublimetext.3 .mysql all
com.sublimetext.3 .txt all
com.sublimetext.3 .less all
com.sublimetext.3 .src all
com.sublimetext.3 .cmd all
com.sublimetext.3 .hta all
com.sublimetext.3 .lua all
com.sublimetext.3 .m all
com.sublimetext.3 .m4 all
com.sublimetext.3 .h all
com.sublimetext.3 .php all
com.sublimetext.3 .pl all
com.sublimetext.3 .pm all
com.sublimetext.3 .py all
com.sublimetext.3 .rb all
com.sublimetext.3 .vbs all
com.sublimetext.3 .tlc all
com.sublimetext.3 .bat all
com.sublimetext.3 .asm all
com.sublimetext.3 .cgi all
com.sublimetext.3 .rss all
com.sublimetext.3 .xml all
com.sublimetext.3 .atom all
com.sublimetext.3 .csv all
com.sublimetext.3 .bak all
com.sublimetext.3 .cnf all
com.sublimetext.3 .log all
com.sublimetext.3 .asc all
com.sublimetext.3 .diff all
com.sublimetext.3 .temp all
com.sublimetext.3 .tmp all
com.sublimetext.3 .class all
com.sublimetext.3 .yml all
# Video Player - VLC
org.videolan.vlc .avi Viewer
org.videolan.vlc .mkv Viewer
org.videolan.vlc .wmv Viewer
org.videolan.vlc .mp4 Viewer
org.videolan.vlc .m4v Viewer
org.videolan.vlc .mpeg Viewer
org.videolan.vlc .webm Viewer
org.videolan.vlc .mov Viewer
org.videolan.vlc .flv Viewer
org.videolan.vlc .f4v Viewer
org.videolan.vlc .vob Viewer
org.videolan.vlc .ogg Viewer
org.videolan.vlc .ogv Viewer
org.videolan.vlc .gifv Viewer
org.videolan.vlc .rm Viewer
org.videolan.vlc .asf Viewer
org.videolan.vlc .3gp Viewer
org.videolan.vlc .avchd Viewer
# Image Editor - Photoshop
com.adobe.Photoshop .jpg all
com.adobe.Photoshop .jpeg all
com.adobe.Photoshop .jpg all
com.adobe.Photoshop .bmp all
com.adobe.Photoshop .gif all
com.adobe.Photoshop .tif all
com.adobe.Photoshop .tiff all
Executing duti
duti duti.conf
That's all! With a single command all these extensions are assigned to a different app. Now we can change file association "the bulk way".
Checking Association
Duti can check what app is associated with some extensions too. For instance to check what app is associated with the md (markdown) extension:
duti -x .md
Output:
MacDown.app
/Applications/Editors/MacDown.app
com.uranusjr.macdown
The -x option is also useful to find apps' bundle ids that will be used in the config file. In the example above the blundle id is com.uranusjr.macdown.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}