Changing Your iterm2 Profile Programmatically

Change your iterm2 profile to Production with this command:

echo -e\033]50;SetProfile=Production\a

Create a function to make it easier to switch profiles:

function iterm_profile {
  if [[ -z $1 ]]; then
    profile="Default"
  else
    profile=$1
  fi

  echo -e "\033]50;SetProfile=$profile\a"
}

I use this feature to let me know I am working on the Rails migration.

Source

Written on May 3, 2017 by alistairmckinnell