0

I'm new to Mac from the Linux world, and I am looking for a command or file providing a list to default user applications associated with certain filetypes. For example, on Linux:

$ cat /usr/share/applications/defaults.list

provides the application names and priority hierarchies on Linux. I've tried something similar using defaults on the Mac, but I can't seem to find what I'm looking for.

$ defaults read | grep pdf
  name = "1309.0238.pdf";
  name = "1309.0238.pdf";

Does the Mac operating system have a simple, command-line function or accessible file to find the default applications?

1

Not easily. You can use the well-hidden lsregister command to dump the contents of the Launch Services database, which is what controls which file types open with which applications:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump

but its output isn't well documented -- there's some info here, but it's over 10 years old so it's probably at least partially obsolete. A bit of Googling turns up some AppleScripts for further parsing, that you might be able to adopt:

| improve this answer | |
  • You can also use: /S*/L*/F*/C*/F*/L*/S*/lsregister -dump – user3439894 Mar 15 '17 at 20:27
0

There is a third-party github project called SwiftDefaultApps, which provides a command line tool and a MacOS Preference pane for listing and setting the URIs, UTIs and their app handlers.

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

.
(It's a replacement for the long-standing RCDefaultsApp pane, which completely stopped working in Catalina.)

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .