Macos – Different Terminal color theme for remote connections

macososx lionterminal.app

Is it possible to set Terminal to use a different theme for remote connections. I often have several Terminal windows open at once for both local and remote work and it would be really handy to have the remote connections shown in a different color.

For example, Terminals for the local environment would be in Homebrew. Terminals connected to Server A would be Man Page and Terminals connected to Server B would be Red Sands.

I'm happy to work with hacky/workaround methods, I just can't find anything about this.

Best Answer

I´d suggest duplicating the existing themes you want to use, renaming them to the Server´s names and have the new themes execute a custom shell command (in this case ssh) on startup (this can be configured in the theme preferences within the "shell" tab). This way these new themes will appear in the "Shell" > "New Window" menu, so that you could even assign them a shortcut (e.g. cmd+alt+a for server "A" and so on).

Another way would be to create a shell script that executes an applescript which then changes the theme in the current window and executes ssh afterwards; but I´m not sure at the moment how to reset the theme once you´re finished.

Your last option would be to configure differently coloured PS1 prompts on each server you ssh into, this is what I usually do.

Related Question