Applescript (osascript) for changing Terminal.app profile

applescriptterminal

Is here a way to changing the Terminal.app profile from the command line?

Here is already couple of questions about changing colors, but I need change the whole profile from the "Basic" (what is my default) to "Homebrew" or "Pro" from the shell script.

Looking for only clean command-line solution (e.g. without clicks, global shotcuts etc.), so probably with osascript. Need it because want change the Terminal.app behavior when ssh-ing into another computer, e.g. font-size, encoding, colors, emulation – the whole profile – not only colors.

Like something next:

some_commands_here to change the CURRENT terminal profile into another
ssh user@example.com

And no, I don't want use iTerm2. 🙂

Ps: ok, as the last resort, shortcuts are acceptable, but no clicks. 🙂 🙂

Best Answer

$function setTerm() { PROFILE=${1}; echo "tell app \"Terminal\" to set current settings of first window to settings set \"${PROFILE}\""|osascript; };

Source: commandlinefu.com

When you connect to a remote computer using ssh, the terminal.app settings will set according to the remote bash profile. Therefore you need to define the preferred settings on the remote machine first.