How to run zsh and tmux with xterm-256color by default

Solution 1:

Usually tmux should get the TERM parameter from your terminal emulator. So you could just set it to xterm-256color in your its configuration.

If this does not work for some reason, you can start tmux like that

tmux -2

The parameter -2 forces tmux to assume 256-color support. Additionally you can set default-terminal in your `~/.tmux.conf

set -g default-terminal "screen-256color"

Solution 2:

For proper installation, follow this order:

  1. Install zsh
  2. Run zsh from your terminal/bash
  3. Set zsh as default terminal/bash
  4. Setup tmux to run as default

After zsh is installed, run it from terminal

$ zsh

now set zsh as default Shell with

$ chsh -s /bin/zsh 

Note that you must be on zsh when typing this command (tested this on my Ubuntu 14.04.2 LTS - trusty)

SO, now you've setup the default Shell... All you have to do now is setup tmux as default, and it will load automatically zsh instead of the Bourne Again Shell (Bash).

To setup tmux as default, put this in your ~/.zshrc before your aliases; the code for other shells is very similar:

[[ $TERM != "screen" ]] && exec tmux