I want to enable italics in tmux (inside iTerm2 on macOS Big Sur 11.3). I have achieved this by setting this in .tmux.conf
set -g default-terminal "tmux-256color"
And I have installed ncurses 6.2 using homebrew and set it first in the path. .zshrc
:
export PATH="$HOMEBREW_PREFIX/opt/ncurses/bin:$PATH"
After those changes, italics work.
However, now several ncurses-dependent programs fail to start:
Both ncdu
(1.15.1) and nano
(2.0.6 ) error out with:
Error opening terminal: tmux-256color.
I get the impression that they don't support this TERM
setting. Weirdly, ncdu
1.12 works with tmux-256color
on my Raspbian computer.
What's wrong? Aren't programs like ncdu
and nano
supposed to be compatible with tmux-256color
?
I have found a hacky workaround (for macOS, not needed on Raspbian). If I explicitly change back the TERM
variable in .zshrc
, everything (both italics and programs) works:
if [[ "$TERM" == "tmux-256color" ]]; then
export TERM=screen-256color
fi
But my understanding is that setting TERM
yourself is a big no-no. You are supposed to let the environment set that correctly. And I'm surprised it works at all - is tmux-256color
compatible with screen-256color
? Will this hack blow up in my face eventually?