macOS has ncurses version 5.7 which doesn't ship the terminfo description for tmux. There're two ways that can help you to solve this problem.
Instead of tmux-256color
you can use screen-256color
, place this command into your ~/.tmux.conf
.
set-option -g default-terminal "screen-256color"
Firstly, we need to install latest version of ncurses by using brew
.
$ brew install ncurses
After that, we're going to use infocmp
that prints a terminfo description.
$ /usr/local/opt/ncurses/bin/infocmp tmux-256color > ~/tmux-256color.info
Finally, we need to compile the description to our system database and set default-terminal
into ~/.tmux.conf
.
$ sudo tic -xe tmux-256color tmux-256color.info
set-option -g default-terminal "tmux-256color"
Also, don't forget to enable RGB. For instance, if you use Alacritty terminfo outside of tmux.
set-option -sa terminal-overrides ",alacritty:RGB"