I would recommend SwiftDefaultApps which is described as "Replacement for RCDefaultApps, written in Swift".
(Longtime Mac users will remember RCDefaultApps as a preference pane which could be used to set default apps for certain types of files.)
What makes SwiftDefaultApps the better solution, IMO, is that most of the other suggestions seem very complicated and involve a lot of scripting. SwiftDefaultApps not only gives you a GUI way of making these changes without going through the "Get Info" panel, but it also has a command-line tool which is much simpler than the other solutions posted so far.
If you download the latest release (currently SwiftDefaultApps-v2.0.1.zip
) you will find a preference pane and (this is the important part) a command-line tool named swda
(which stands for [sw]ift [d]efault [a]pps, of course).
The preference pane is a very easy GUI-based way to set your defaults without having to go through "Get Info" again and again, but the swda
tool is what you are looking for.
Run swda
with no arguments to get a basic "usage" prompt:
Utility to retrieve and manipulate default applications in macOS.
Available commands:
- getHandler Returns the default application registered for the URI Scheme or <subtype> you specify..
- getApps Returns a list of all registered applications.
- getSchemes Returns a list of all known URI schemes, accompanied by their default handler.
- getUTIs Returns a list of all known UTIs, and their default handler.
- setHandler Sets <application> as the default handler for a given <type>/<subtype> combination.
- help Prints this help information
- version Prints the current version of this app
Use swda foo
to get more information on how to use foo
such as swda setHandler
.
With swda
, I can see which kinds of files are set to use TextEdit (instead of BBEdit )
swda getUTIs | fgrep -i textedit
or, worse, Xcode:
swda getUTIs | fgrep -i Xcode
Nothing worse than double-clicking a .sh
file expecting it to open in BBEdit, only to see Xcode launch. 😮
For example:
swda setHandler --UTI public.shell-script --app /Applications/BBEdit.app
results in:
SwiftDefaultApps SUCCESS: Default handler has succesfully changed to com.barebones.bbedit
It may take a little time to go through all the different settings, but I believe that swda
is the easiest way to accomplish what you're looking for, and once you have things set the way that you want them, it should be easy to write a small shell script to replicate those choices on a new Mac.