OS X 10.8 / Terminal / VIM / xterm-color
September 24th, 2012 | Back to Blog Listing
It's not often that I make pure technology posts on my blog, but I thought this problem demanded some attention after I couldn't find the cause, much less the solution online.

I recently upgraded my MacBook Pro (as I do every two years) and ran into an extremely frustrating issue with the new version of Terminal. I will stop and say that this is probably an extremely niche problem. It is also almost certainly limited to software developers, not end-users.

That all prefaced, this is pretty much limited to people who happen to use the Terminal program in OS X, happen to run VI / VIM as their text editor, and happen to prefer syntax highlighting to be enabled. This may even be limited to certain color schemes (I prefer the "evening" scheme).

If these conditions are met, then you've probably noticed that your color scheme has more or less been destroyed as of recent - at least destroyed in the sense that your eyes are trained to see certain programatic statements in a certain color, and now that no longer applies. I've been using the "evening" scheme for over a decade now and can barely read it now on my new Apple. But why?


A basic PHP in VIM with the evening color scheme enabled using xterm-16color OS X 10.8, or just xterm-color on previous OS X versions.



A basic PHP in VIM with the evening color scheme enabled using xterm-256color OS X 10.8 (the new default).




The new version of Terminal has extended the Terminal TTY settings. The previous version allowed the user to switch between xterm and xterm-color (amongst others). The new version allows the user to switch between xterm, xterm-16color, and xterm-256color. It just so happens that the old version of xterm-color ran with 16 colors, and the new version defaults to xterm-256color.

This is all fine and good, but it doesn't fly very well with most of the VIM syntax schemes. If you use standard Linux/BSD color highlighting, you may have also noticed that some of those colors are slightly different now. This is also due to the change.

To fix the problem, open up the Preferences in Terminal. Select the Advanced tab and where it says "Declare terminal as:", change that to xterm-16color.

You'll need to restart Terminal (or at least open a brand new window) for the change to take effect.


The two different terminal declaration types in the new OS X 10.8


Updated Sunday June 24th, 2018: After moving forward with yet another Apple OS X version and having to reconfigure my terminal settings, I discovered that this newer version has the same problem whether the xterm-color is set to xterm-16color OR xterm-256color. I changed the setting to the oldest one, xterm, restarted Terminal, and the problem seemed to be fixed.

Ideally you would be able to use the full color palette while using Terminal, but if you are just using the older standard ANSI colors like I am, it seems to work exactly the same as you would want it to.

This new change is specifically for OS X 10.13.5 (High Sierra).