Skip to content

Instantly share code, notes, and snippets.

@bbqtd
Last active October 8, 2025 02:13
Show Gist options
  • Save bbqtd/a4ac060d6f6b9ea6fe3aabe735aa9d95 to your computer and use it in GitHub Desktop.
Save bbqtd/a4ac060d6f6b9ea6fe3aabe735aa9d95 to your computer and use it in GitHub Desktop.

Revisions

  1. bbqtd revised this gist Jul 14, 2020. 1 changed file with 65 additions and 12 deletions.
    77 changes: 65 additions & 12 deletions macos-tmux-256color.md
    Original file line number Diff line number Diff line change
    @@ -1,43 +1,96 @@
    # Installing tmux-256color for macOS

    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.
    * macOS 10.15.5
    * tmux 3.1b

    macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

    ## The Fast Blazing Solution

    Instead of `tmux-256color` you can use `screen-256color`, place this command into your `~/.tmux.conf`.
    Instead of `tmux-256color`, use `screen-256color` which comes with system. Place this command into `~/.tmux.conf` or `~/.config/tmux/tmux.conf`(for version 3.1 and later):

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

    The `screen-256color` in most cases is enough and more portable solution. But it does not support any italic font style.

    ## The Right Way

    Firstly, we need to install latest version of ncurses by using `brew`.
    Unfortunately, The latest (6.2) ncurses version does not work properly. Make sure to use ncurses which comes with macOS:

    ```
    $ which tic
    /usr/bin/tic
    ```

    If you see another path to terminal info compiler, you must fix the `$PATH` for a shell, or uninstall a local ncurses by using a package manager.

    Let's download and unpack the latest nucurses terminal descriptions:

    ```
    $ curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz && gunzip terminfo.src.gz
    ```

    And compile `tmux-256color` terminal info. The result is placed into `~/.terminfo`:

    ```
    $ /usr/bin/tic -xe tmux-256color terminfo.src
    ```

    If you want to use `tmux-256color` for all users, use `sudo`. The result is placed into `/usr/share/terminfo`:

    ```
    $ sudo /usr/bin/tic -xe tmux-256color terminfo.src
    ```

    You may also to compile few more infos, it is up to you:

    ```
    $ brew install ncurses
    $ /usr/bin/tic -xe alacritty-direct,tmux-256color terminfo.src
    ```

    After that, we're going to use `infocmp` that prints a terminfo description.
    If you see something like:

    ```
    $ /usr/local/opt/ncurses/bin/infocmp tmux-256color > ~/tmux-256color.info
    "terminfo.src", line 1650, terminal 'pccon+base': enter_bold_mode but no exit_attribute_mode
    "terminfo.src", line 1650, terminal 'pccon+base': enter_reverse_mode but no exit_attribute_mode
    ```

    Finally, we need to compile the description to our system database and set `default-terminal` into `~/.tmux.conf`.
    do not worry, all should be fine. Make sure that you can use the compiled description:

    ```
    $ sudo tic -xe tmux-256color tmux-256color.info
    $ infocmp -x tmux-256color
    ```

    And finally, set default terminal in tmux configuration file:

    ```
    set-option -g default-terminal "tmux-256color"
    set-option default-terminal "tmux-256color"
    ```

    ## RGB Colors

    Also, don't forget to enable RGB. For instance, if you use [Alacritty](https://github.com/jwilm/alacritty) terminfo outside of tmux.
    Also, do not forget to enable RGB colors (24 bit colors, or true colors, as you like). The `$TERM` outside tmux must support 256 colors. Also, it must contains `Tc` or `RGB` flag in terminfo description:

    ```
    $ tmux info | grep -e RGB -e Tc
    ```

    If both are missing, then you need to override terminal description in tmux configuration file:

    ```
    set-option -a terminal-overrides ",XXX:RGB"
    ```

    where `XXX` is a terminal outside tmux, like `xterm-256color`. And finally, `terminal-overrides` suports a pattern matching:

    ```
    set-option -a terminal-overrides ",*256col*:RGB"
    ```

    If you use [Alacritty](https://github.com/jwilm/alacritty) terminal, make sure the `$TERM` outside tmux is `alacritty-direct`. The `alacritty` terminal description does not have `RGB` flag. Otherwise, override description:

    ```
    set-option -sa terminal-overrides ",alacritty:RGB"
    set-option -a terminal-overrides ",alacritty:RGB"
    ```
  2. bbqtd created this gist Oct 17, 2019.
    43 changes: 43 additions & 0 deletions macos-tmux-256color.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    # Installing tmux-256color for macOS

    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.

    ## The Fast Blazing Solution

    Instead of `tmux-256color` you can use `screen-256color`, place this command into your `~/.tmux.conf`.

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

    ## The Right Way

    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"
    ```

    ## RGB Colors

    Also, don't forget to enable RGB. For instance, if you use [Alacritty](https://github.com/jwilm/alacritty) terminfo outside of tmux.

    ```
    set-option -sa terminal-overrides ",alacritty:RGB"
    ```