What are all of the URI Schemes Available on macOS
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?
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)