MacOS – Set iTerm2 as the ssh:// URL handler

itermmacossshterminal

Currently, Terminal is set to handle SSH urls. For example, if I do:

$ open ssh://machine.example.com

Then it will spawn a new SSH session in terminal. I'd like these to be opened in iTerm2 instead. How do I tell macOS to use iTerm2 to handle ssh:// URLs instead of Terminal?

Best Answer

iTerm2 can set itself as the default SSH handler. In its preferences, go to “Profiles”. Create a profile to handle SSH sessions, or select an existing one. In the “General” section, bottom right, you can select which URL scheme this profile should handle:

Screenshot of iTerm2 preferences, General section of Profiles pane

Select SSH. iTerm2 will ask if it is to set itself up as the default SSH handler:

Screenshot of iTerm2 asking for confirmation to set itself up as the default SSH handler

Confirm and you are done. Happy remoting.