tmux/tmux

Using tmux-256color with macOS's Terminal.app

Closed this issue · 7 comments

Is setting TERM=tmux-256color expected to work on Terminal.app?

Line drawing is degraded and I get multiple characters while typing. If I run reset I get

reset: can't initialize terminal type tmux-256color (error -1)
Terminal type?

tmux v2.6
macOS 10.13.3

macOS doesn't have any tmux terminfo definitions; at least not on my system (which is running bleeding edge macOS beta releases). It does have quite a few screen definitions in /usr/share/terminfo/73/. I've created my own tmux-256color.terminfo and ~/.terminfo/ directory to hold the compiled form. I do that because I wanted to add some custom attributes such as support fo italics.

@krader1961 could you post those settings? They would be much appreciated!

See the attached files. Note that I only use Terminal.app when I need to debug something that might depend on that terminal emulator. I normally use iTerm2.app.
tmux-256color.terminfo.txt
xterm-256color.terminfo.txt

for anyone interested... @krader1961 thank you.

I have zsh and iTerm2, which sets xterm-256color by default. Of course none of my init files set up $TERM.

I badly wanted to make colors and escape codes work well in tmux, so I set the default terminal to tmux256-color in my .tmux.conf, but thereafter I encountered several problems, which made me think that things were not really set up correctly (like man or git diff complaining about the terminal).

within tmux: echo $TERM was working properly, and running infocmp tmux-256color gave no issues though.

Meanwhile, while browsing for possible solutions on git issues (and yet it took me 7-8 hrs to find this page), I run into neovim/neovim#7353. I tried to run :checkhealth in neovim too, to look at issues reported by an incorrect terminal type and, with no surprise, had a confirmation that things were broken; but neovim gave me an interesting advice: infocmp -L could not open ....

well, long story short, running /usr/bin/infocmp tmux-256color fails badly, while running /opt/local/bin/infocmp tmux-256color played nicely.

I use MacPorts, and I have a terminfo database in /opt/local/share/terminfo which contains tux-256colors (while /usr/bin/terminfo does not). Of course, /opt/local/bin also contains tic and infocmp and my zshrc sets up /opt/local/ in $PATH to shadow /usr/bin.

I've then spent hours trying to override /usr/bin/infocmp with its port version at a "pre login state' with absolutely no luck. All I had to do was to recompile tmux-256color with /usr/bin/tic into ~/.terminfo and everything worked nicely. finally.

I'm happy, but something bothers me... how can I make tmux or vim to look at /opt/local instead of /usr/bin ?

I tried to export /opt/local as well as setting $TERMINFO in my .zshenv hoping that non interactive shells would look there, but it seems that all environment variables set in my .zshrc or .zshenv got ignored

sorry for the long post, please help out my curiosity!

kindly,
TL

Asheq commented

See the attached files. Note that I only use Terminal.app when I need to debug something that might depend on that terminal emulator. I normally use iTerm2.app.
tmux-256color.terminfo.txt
xterm-256color.terminfo.txt

Thanks! Are these official/latest? @krader1961

The solution provided by bbqtd worked perfectly file. Below is the summary:

$ brew install ncurses
$ /usr/local/opt/ncurses/bin/infocmp tmux-256color > ~/tmux-256color.info
$ tic -xe tmux-256color tmux-256color.info
# This creates a complied entry in ~/.terminfo
$ infocmp tmux-256color | head
#       Reconstructed via infocmp from file: /Users/libin/.terminfo/74/tmux-256color
tmux-256color|tmux with 256 colors,
lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.