Important: Please read the Qt Code of Conduct -

Url schemes on OS X

  • Hi,

    I got url schemes working on iOS; redirecting to the URL scheme address in the browser switches nicely back to the application. However, I cannot get them working on OS X. Going to the url scheme address on a browser does not bring the application to the foreground. I think I might not understand everything correctly that relates to using url schemes on OS X.

    My questions are:
    a) Should URL schemes work on a dev mode application on OS X, if you simply set the URL scheme to the info.plist inside the application package, or do you actually have to make a deployment version of the app and install it, and only then the system would recognize the scheme? My logic for this suspicion is that with the iOS build, the app is installed to the device, thus making any necessary arrangements there. I have to admit that I am not fully aware of the insides of the Apple's configuration mechanism involving the info.plist file on either OS.
    b) On iOS I am catching the URL scheme calls with the QDesktopServices::setUrlHandler function. Would it be same for the desktop? Of course I can't test this yet, as I can't get it working that the browser URL call would switch the application back to the foreground.

    What I am trying to do is to launch an external browser to authorize dropbox usage with the application, and then the flow redirects to a page that redirects using the url scheme, which should then switch the application to the foreground.


  • @Archie888 said:

    a) Should URL schemes work on a dev mode application on OS X...

    They don't if you're using a version that has this bug:


  • Thanks for the input.

    It looks to me that that bug is about a situation, where the application does get focus, but there is a problem with the url in the evoking event's data.

    My current problem is that I cannot get the OS to start my application (or switch to it if it is already running, which is my normal scenario).

    I am working with Qt 5.4.

    I will have to update my current situation, however: I have now learned that one must perhaps setup the url scheming either (perhaps?) in the file [user]/Library/Preferences/ or in the file [user]/Library/Preferences/

    However, trying to add my setup to either file does not seem to help.

    Here is my setup in either file:

        LSHandlerPreferredVersions =     {
            LSHandlerRoleAll = "-";
        LSHandlerRoleAll = "com.myappproject.myappname";
        LSHandlerURLScheme = myappname;

    Ps., it seems that if I use the secure file, the entry is automatically erased from there for some reason.

    The info.plist in the application package has the URL scheme correct, I believe:


    Also, I have setup there the bundle identifier, which I believe(?) should identify the application for the launch services mechanism:


    As a contrast, when my redirection page is set to call webcal://, which is a url scheme for the calendar app in OS X, a pop up is launched, which asks whether it is ok to start the calendar application. With myappname:// it seems like nothing happens, so this is my current problem.

  • I wonder if there is something to this that I am missing here:

    Launch Services Database

    Launch Services maintains a central data structure, the Launch Services database, in which it records all of the pertinent information about applications and the kinds of document files and URLs they are capable of opening. Whenever a new application becomes known to the system (such as when the user drags it from an installation disk into the Applications folder), the application is registered with Launch Services, which copies the needed information about the application into its database. Launch Services can then use this information to determine the preferred application for opening a given document file or URL.

    source:, Launch Services Concepts

    So there is some sort of installation that needs to be done on OS X, before url schemes can be tested? I wonder if this could be done programmatically in the dev version by editing system files.

Log in to reply