How to set iTerm2 as the default ssh:// handler on Mac OSX

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, December 09, 2015

Follow me on Twitter as @mattiasgeniar

If you click a link on Mac OSX that starts with ssh://, you can have it spawn iTerm2 as the default SSH handler instead of the ‘classic’ Terminal.app. Here’s how you change it.

Change the default ssh:// handler in iTerm2 itself

Go to Preferences > Profiles > General and mark the “ssh” URL scheme in the dropdown at the bottom.

iterm2_ssh_handler

You’ll be prompted to confirm changing the default handler and you should be good to go.

Change the default ssh:// handler with Default App

If the above didn’t work (because it didn’t for me) there’s an alternative. First, download and install the Default Apps preferences tool.

Since you’re using iTerm2 and looking to change the ssh:// handler, I’ll assume you know your way around your Mac and you can figure out how to install that tool yourself.

Once you’ve got it installed, go to your System Preferences, search for Default Apps at the bottom and open it.

default_apps_preferences

In there, go to URLS and find the “ssh” option. In the dropdown to the right, chose your preferred tool.

default_apps_ssh_handler

Good to go!

The result

Every time you click on a ssh:// link, your Mac can now open iTerm2 to connect to that IP or hostname. This is especially useful if you’re having your server alerts or management tools link directly to ssh://10.0.5.1 and you can just click it to login in.

For instance, here’s how our monitoring is reported in Hipchat at Nucleus.

hipchat_notification_alert

All the relevant information and a clickable IP address, linked as ssh://1.2.3.4 for our convenience.

Saves another couple of seconds a day!



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.