There seems to be two different SSH client versions on my Macbook Pro running Sierra (10.12.4). If I do the following:

$> ssh dev

It works just fine. However, if I do the following:

$> open ssh://dev

It opens a new terminal which then complains about the encryption settings in my ssh_config file. Researching the specific complaints, I found out that opening through the protocol handler is using an older version of SSH.

How do I change which SSH client the protocol redirects to?

  • 1
    What do you get when you type "which ssh" and what do you get when you type "ps aux | grep ssh" after running the second command? – Brethil May 16 '17 at 15:27
  • Which ssh: /usr/local/bin/ssh The SSH process kills itself after running it through the second method, I'm not sure how I would keep it alive to see it in the process list. – Joshua Gilman May 17 '17 at 18:24

You can use a tool that is very comfortable to change the default app for specific URL handlers.

Change the ssh URL scheme with RCDefaultApp

  1. Download RCDefaultApp Version 2.1
  2. Install the Preference Pane
  3. Go to System Preferences > Defaults Apps > URLs
  4. Go to "ssh"
  5. On the right side, select your preferred application

It will look very similar to this screenshot:

RCDefaultApp Screenshot showing the preference pane

  • The problem isn't based on the terminal application, but rather which SSH binary is being called. I can change the application to open iTerm instead of Terminal and the problem still persists. – Joshua Gilman May 17 '17 at 18:17

To answer your question about changing the ssh:// protocol client,

Per https://superuser.com/a/548122/202319 , you can modify ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist to open any app with a registered identifier when ssh:// or another URL is encountered.

This is not a perfect solution, because it still requires an app bundle, or will use Terminal.app (which is what you see already).

But, you should be able to fix your .login or .bashrc files so the default Terminal.app shell would use your preferred ssh anyway.

  • 1
    Can you elaborate on the .login and .bashrc config changes? The problem is not which terminal app is being opened, but rather which SSH binary is being executed. Calling ssh inside a terminal session calls one binary, but have the terminal opening the connection through the protocol is calling another SSH binary. – Joshua Gilman May 17 '17 at 17:53

I have no mac to check right now but my guess is:

Mac comes with ssh client /usr/bin/ssh

You installed newer version on /usr/local/bin/ssh

You can try removing /usr/bin/ssh or rearrange order of $Path so it'll pick /usr/local/bin/ssh first

  • Unfortunately Apple killed the ability to touch stuff in /usr/bin. I had already tried re-arranging the PATH variable to put my local bin upfront, but it seems that the ssh:// protocol is explicitly calling /usr/bin/ssh as the change didn't work. – Joshua Gilman May 19 '17 at 15:09
  • you can if you disable SIP in recovery mode: csrutil disable – Michał Gąsior May 20 '17 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .