I am using the Solarized color scheme in iTerm2 and it comes with two themes: one with a light background for daytime hours and one with a dark background for nighttime hours.

I am currently switching between them by going to the iTerm2 preferences, clicking Profiles, then Colors, and finally selecting the theme from the Load Presets menu.

My question is: is there a way to bind this to a keyboard shortcut?

  • 2
    I’d love to know this as well :) – mikl Apr 22 '12 at 20:21
  • As a hack you could write an apple script and bind it to a key in iterm. In general I think if they're just those 2 you could define different profiles and just redefine one of the shortcut keys in iTerm to switch to that (you can use any menu item). – Randall Hunt Aug 16 '12 at 6:42
  • @ranman As far as I can tell, selecting a different profile from the menu item creates a new shell using that profile; it doesn't change the color scheme on your existing shells. Am I missing something? – Richard Jones Aug 16 '12 at 17:16

This works on iTerm2 (version, 3.0.8 through 3.0.13)

  1. In iTerm's preferences, select the keys tab.
  2. There's a table called key mappings
    • click on the + at the bottom of the table
  3. Choose a keyboard shortcut
  4. From the dropdown menu, choose the load color preset option
  5. You'll get another dropdown menu to choose the color preset you want

Keys Tab]([https://i.stack.imgur.com/oJ8p1.png)

It works across all panes and windows and its setting is persistent across sessions.

  • Only answer that worked for me... Thanks much – sh78 May 6 '18 at 23:33
  • This should be the accepted answer. – oarfish Jan 19 at 17:44

I found another solution from this site:

Declare a function in your .bashrc or .zshrc: it2prof() { echo -e "\033]50;SetProfile=$1\a" }

Then you can switch profile from CLI with it2prof ProfileName


Note: This is not a complete solution, since it isn't entirely keyboard based, but it's the fastest method I have found to switch between color schemes. Hopefully others find it useful.

  1. Create a profile for each color scheme you want to use (iTerm -> Preferences -> Profiles)
  2. Switch between profiles in your current session (Command-I or View -> Edit Current Session)

One keyboard chord and one mouse click.


Here's what I'm doing to solve this issue. This won't be a good solution if you don't use tmux or screen because it involves quitting and relaunching iTerm. In Preferences -> General there is a checkbox for "Load preferences from a custom folder or URL." Check that box and save your settings (make a copy of ~/.iterm). Then change to the other color scheme and save again. Then I made a script that toggles between the two. If you're using tmux, iTerm quitting and reopening is totally inconsequential so it works for me.

pkill iTerm
sleep 0.2
rm -r ~/.iterm

if [[ -z $SOLARIZED_TOGGLE ]]; then

if [ $SOLARIZED_TOGGLE = "1" ]; then
    cp -rf ~/.iterm_dark ~/.iterm
    cp -rf ~/.iterm_light ~/.iterm

env -i open -a iTerm

I found an apple script that toggle between solarized themes in this repository. I modified the script Toggle Solarized.applescript a bit to make it work on iTerm 2.9 and put it in an executable script for easy theme switching.

It's not perfect though because it doesn't modify your profile (after looking in the iTerm2 dictionary, you apparently can't do that with apple script). So the next time you open a tab, it won't keep the same color. But it does help.


In the current version Build 3.1.4:

  1. Open Preferences.
  2. Under "Profiles" create various Profiles with the desired colors, fonts, etc.
  3. Switch to "Preferences" -> "Keys".
  4. Under "Key Mappings" add "+".
  5. Under "Action:" select "Change Profile".
  6. Set the desired "Profile" and record the desired "Keyboard Shortcut".

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.