Skip to content

Instantly share code, notes, and snippets.

@shawnbot
Last active March 22, 2024 16:26
Show Gist options
  • Save shawnbot/3277580 to your computer and use it in GitHub Desktop.
Save shawnbot/3277580 to your computer and use it in GitHub Desktop.
Make OS X Terminal respect 256 colors in screen

1. Ensure that Terminal declares itself as "xterm-256color"

Under Terminal > Preferences... > (Profile) > Advanced, "Declare terminal as:" should be set to xterm-256color.

2. Build a version of screen that supports 256 colors

This is easy with homebrew:

brew install screen

When this finishes you'll have a new binary in /usr/local/bin/screen.

3. Add the new screen binary to your path

Add /usr/local/bin to the front of your $PATH so that your shell uses this binary, and not the one in /usr/bin (you can confirm that it's using the correct one with which screen). If you're using the bash, this goes into your .bash_profile:

PATH="/usr/local/bin:$PATH"

If you're using another shell, then you probably already know where this goes. :)

@DryLabRebel
Copy link

@buncis I also had to ensure screen ran an interactive login shell. Put this in my.screenrc:

shell -$SHELL

Also $TERM may still be run as screen. So I put export TERM="xterm-256color" in my .bash_profile, so that when screen (or any login shell) is run, it explicitly sets 256 colors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment