MacOS – How to open an application URL


How can I open application URLs in Terminal or Alfred?

My Problem:
I use Airmail2 as default mail client as well as OmniFocus 2 to organize my work. Airmail2 allows to copy application URLs via EDITCopy Message Link, which yields a link like airmail://message?mail=myAccount&messageid=etPan.55ba060a....

When I paste this link in the notes section of a task in OmniFocus, it gets automatically converted into a clickable link that works as expected. Other programs, such as Evernote, will not recognize it as URL. It would be really handy to access these links even outside of OmniFocus.

How can I open these application URLs besides pasting it into an OmniFocus task note section and click it? I would prefer a Terminal command or a script, which I can include in Alfred. The open command of the Terminal does not work unfortunately.

Best Answer

  • Maybe I don't get the question right but:

    You may open such an application URL in almost any available application with text fields or text boxes: highlight the URL (sometimes even only parts of it - at least the scheme and the first character after the :// (e.g. airmail://m - are sufficient to open the application), right-click and choose "Open URL". And yes, it's of course also working in the Chrome/Safari Omnibar: Just enter the URL and hit the "Enter" key.

    In Evernote you have even two ways to open it:

    • You may paste the URL(s) in a note and by choosing the whole URL or parts of it the context menu offers "Open URL"
    • If you have only one application URL in your note, you may add the URL to the "Note info" (red circle) and then you'll get a clickable link with the "scheme specific part" of the URL or only parts of the "scheme specific part" - here "message" (blue circle).

      enter image description here

    In the Terminal you have several ways to open the URL:

    • highlight the whole URL or parts of it and the context menu offers "Open URL"
    • highlight the whole URL and command & double click it
    • enter open URL
      (e.g. open airmail://message?mail=myAccount&messageid=etPan.55ba060a....)
      (OK, the interaction between Terminal and Airmail2 uncovers a glitch, because Airmail2 opens if closed, gets to the front and the message is chosen, but the GUI is not visible.)