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