Is there a way to make the Terminal support the OSC 8 styled hyperlinks?
This,
printf '\033]8;;http://example.com\033\\This is a link\033]8;;\033\\\n'
Just prints out This is a link
. But it is not clickable.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityIs there a way to make the Terminal support the OSC 8 styled hyperlinks?
This,
printf '\033]8;;http://example.com\033\\This is a link\033]8;;\033\\\n'
Just prints out This is a link
. But it is not clickable.
This has come up before (see Is there a way to make a link clickable in the OSX Terminal?, Configure OS X Terminal to detect URLs and make them clickable?), and it seems not to be possible to use OSC 8 in macOS Terminal.
It also isn't required. You can just double-click with Cmd pressed on any URL shown in a Terminal window to have it open in the default browser.
You can use Terminal capabilities to underline text with tput
tput smul; echo https://apple.stackexchance.com/; tput rmul
but this might be confusing because the click behavior is not the same as in a browser.