11

This question comes as an offshoot from this question Can MacOS Dictionary be invoked by a URI?

I remembered that there are a number of URI schemes that can utilized in macOS, but I couldn't remember how to list them. For example, there is x-man-page:// that allows you to create a link to any particular man page and open it up in a Terminal Window with it's own profile: How to open the Apple URL protocol x-man-page:// in iTerm and not Terminal (default)

This existing question: How can I see what custom URI schemes are registered? relied on a now defunct tool called RCDefault App that would allow you to not only list all available URIs but associate them with any particular app (i.e. telnet:// with iTerm2)

So, in attempting to answer the question, I couldn't remeber the URI scheme and needed a way to find them. Is there a way to list all of the registerd URI schemes?

1 Answer 1

18

Use lsregister

The command can be found in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister. I suggest creating a symlink to one of the directories in your PATH for easy access. You can copy and past the following command for simplicity

% sudo ln -s /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister /usr/local/bin/lsregister 

Now, you can run lsregister from anywhere.

Dump the URL Binding Table

lsregister has a number of database tables that contain various application registration details. The table that we're interested in is URLSchemeBinding

% lsregister -dump URLSchemeBinding

This will give you the full list from afp:// to x-man-page://.

To find the URL scheme used for the dictionary we can grep for it:

% lsregister -dump URLSchemeBinding | grep "dict*"
dict:               35608 (0x8b18) (0x8b1a)
x-dictionary:       35604 (0x8b14) (0x8b16)
3
  • 9
    This should be obvious to everyone, but just in case—if you only intend to run this once and would rather not pollute /usr/local/bin, you can just run the command from its original location directly. One fell swoop: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump URLSchemeBinding Commented Jul 29, 2020 at 1:49
  • 1
    Alternative approach: alias lsregister='/System/Library/Frame…/lsregister in session profile e.g.,.zshrc. Commented Oct 1, 2023 at 23:42
  • I tried to find this on MacOS 15.4.1, but unfortunately I cannot use/find lsregister Commented May 2 at 6:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.