Last Updated: February 25, 2016
·
1.302K
· wojtekkruszewsk

Change iTerm2 profile from the terminal

Assuming iTerm has a profile named "Evening":

#!/bin/sh
echo -e "\033]50;SetProfile=Evening\x7"

Or choose profile via argument:

# profile.sh:

#!/bin/bash
echo -e "\033]50;SetProfile=$1\x7"

./profile DarkMode

In Vim you can add command to change Vim color scheme and iTerm profile at the same time (assuming iTerm has a profile named "Dark"):

command Dark  colorscheme solarized | set background=dark  |                          silent !printf '\e]50;SetProfile=Dark\x7'