Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enable ANSI colors in 10.2.x Terminal program UNIX
To get ANSI Colors in Terminal.app when running Jaguar (Mac OS X 10.2), all you need to do is open the Terminal and type:
 % setenv TERM "xterm-16color"
To have this always be your setting, add the above line to your .tcshrc file (and create the file if necessary).
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[14,384 views]  

Enable ANSI colors in 10.2.x Terminal program | 27 comments | Create New Account
Click here to return to the 'Enable ANSI colors in 10.2.x Terminal program' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
What does this mean?
Authored by: kirkmc on Nov 13, '02 10:30:23AM

When running the command in the tip, I get the following:

tcsh: Cannot open /etc/termcap.
tcsh: using dumb terminal settings.

What does that mean?

Kirk



[ Reply to This | # ]
RE: What does this mean?
Authored by: nvdingo on Nov 13, '02 12:22:37PM

It means that you don't have an /etc/termcap file, which is where the information about what colors to use for what comes from.

I don't either, and the hint caused problems. i couldn't even get into 'vi' again to edit it out of my .cshrc file until i did setenv TERM "ansi" (i guessed randomly and vi would run again.)

setting it to ansi does not give you colors, but at least the shell and apps like vi understood the TERM type.

I don't know where to get the termcap file either. sorry.



[ Reply to This | # ]
What does this mean?
Authored by: agengler on Nov 13, '02 01:58:16PM

I had the same problem. It turns out that for some reason os 10.2 didn't put a termcap in /usr/share/misc

I was lucky to have some email me their termcap and I put it there and now everything works fine.



[ Reply to This | # ]
Re: Missing File
Authored by: Whisper on Nov 13, '02 02:21:15PM

Any ideas as to where everyone else can get a termcap file?



[ Reply to This | # ]
what does it do ?
Authored by: little_dude on Nov 13, '02 11:02:39AM

i issued the cmd, but didn't see much of a difference. Which parts of terminal are supposed to get colorized ?



[ Reply to This | # ]
help setting .tcsh
Authored by: kerim on Nov 13, '02 11:26:51AM

Last hint of this sort (relating to the prompt) led me to make a .tcsh file. Doing so suddenly made all of my commands impossible to run (the terminal couldn't find them). I tried the .resources.mine alternative but that did nothing. Is there some trick to getting terminal settings to stick? Is there a problem with using FINK?



[ Reply to This | # ]
help setting .tcsh
Authored by: rand on Nov 13, '02 11:38:15AM

no it is not a problem with Fink.

open your .tcshrc file and at the very top put this line in :

source ~/.cshrc

fink will work again.



[ Reply to This | # ]
help setting .tcsh
Authored by: agengler on Nov 13, '02 02:06:38PM

If you created on I suggest the first line should be
source /usr/share/tcsh/examples/rc
that's in 10.2. It's in a different place under 10.1
then add customization.



[ Reply to This | # ]
help setting .tcsh
Authored by: speumanes on Nov 29, '02 01:22:02AM

You have said, that someone sends you a working termcap-file. Is it possible to get a WORKING termcap for color in ls in the terminal under 10.2.2 from you?

If it is possible, mail it please to speumanes@macnews.de.

Thank you.

Speumanes



[ Reply to This | # ]
what does it do ?
Authored by: agengler on Nov 13, '02 02:08:30PM

You can see the difference if you do a man and the subtitles will be in color



[ Reply to This | # ]
hmmm didn't work
Authored by: falkaholic on Nov 13, '02 02:26:47PM

I copied an /etc/termcap from my linux 7.2

spat out a bunch of syntax errors and didn't work.



[ Reply to This | # ]
Not xterm-16color
Authored by: Frankus on Nov 13, '02 04:01:26PM

Please be careful to use a terminal definition entry that is valid on your system.
You may have more success with "xterm-color" which is often available in many systems. And was recognized on my default 10.2.2 config. As far as seeing color when using "ls" for example; look at the ls man page for info.

Frank.



[ Reply to This | # ]
Not xterm-16color
Authored by: foon on Nov 13, '02 05:43:29PM

How do we find which are valid with our system? Both xterm-color and xterm-16color work on my machine (seen by playing nethack), but when I use them I can't run programs on a sun unix machine I ssh into.



[ Reply to This | # ]
Not xterm-16color
Authored by: Frankus on Oct 07, '11 01:42:35AM

This might help:

http://tldp.org/HOWTO/Text-Terminal-HOWTO-16.html



[ Reply to This | # ]
Not xterm-16color
Authored by: paploo on Nov 14, '02 11:35:31PM

I had to get a compile of lscolor for OS X in order to get a color ls. I should note that I've been using it since before 10.2, so I don't know if they made the default ls color or not. I also have no clue where I got the thing anymore, so don't ask. :)

-Jeff



[ Reply to This | # ]
screen works for me.
Authored by: prk on Nov 13, '02 05:45:43PM

I set my TERM to "screen" and it works very well. I get color vim, and when I ssh to my Linux system I get color Mutt. I did not have any problems with setting it to "screen".

One thing that does really get to me is the home, end, pgup, and pgdown keys. Its very hard to use vim for text processing without them (if your used to them). I am now swiching from vim to bbedit. I really miss block select and other things.



[ Reply to This | # ]
screen works for me.
Authored by: pmccann on Nov 14, '02 09:27:48AM

Well if you happen to have (another) sack of gold lying around the home you'll be happy to know that the just-released bbedit 7 has rectangular selections. As per the first sentence, you'll probably not be so happy to find out the cost of the update. OUCH!



[ Reply to This | # ]
screen works for me.
Authored by: sharumpe on Nov 14, '02 11:33:55AM
I have been upgrading BBEdit since I bought the 4.0 version quite a few years ago. For the amount of time I spend in the program, the cost so far has been a bargain. For something like $300 total, I have been able to gain ENORMOUS efficiencies over something like vi (which I also use a LOT) for Perl, Java, HTML and XML development. If they want to ask for $50 every year or year and a half, no problem by me. I've made WAY more than that off of it. Kudos to BareBones. Mr. Sharumpe

[ Reply to This | # ]
No true ANSI on Mac yet - that I know of...
Authored by: bluehz on Nov 13, '02 06:10:02PM

I have tried various hints, etc setting up color in terminal, termcaps, etc and have always reverted back to non-color as the terminal slowed to a crawl when asked to display a long dir listing for example. Doesn\\\'t really make any sense why it should slow down - but it definitely does.

Also - not sure about this tip - but in most case I believe that true ANSI color and display is not possible on Mac as there does not seem to be any good terminal fonts available with the various symbols, chars used to create the patterns, etc. in an ANSI display. A good example - many of the unixers have created very intricate terminal prompts with fading color backgrounds behind the actual prompt. So far I have yet to see an ANSI font that will work on the Mac and provide the symbol chars necessary to create those effects.



[ Reply to This | # ]
No true ANSI on Mac yet - that I know of...
Authored by: falkaholic on Nov 13, '02 07:08:26PM

In fink, you'll find:

ncurses 5.2-7 Full-screen ascii drawing library

Thats what is used in linux and so forth for colour shells. I havn't tried it myself though.



[ Reply to This | # ]
The fix
Authored by: SonicMcTails on Nov 13, '02 08:26:46PM

I published a hint about this before. YOu need to have ncurses installed, so install fink first (http://sf.net/projects/fink), and then add setenv TERM=xterm-color . to prove that it working, open dselect, and then look at the Selection screen.



[ Reply to This | # ]
A more
Authored by: woode on Nov 13, '02 09:06:37PM

I had the same problem as above -- couldn't find /etc/termcap. So I just installed the OS X 10.2 Developer Tools CD that comes with OS X 10.2. Fixed the problem right up, and with the "official" files.



[ Reply to This | # ]
More on Termcap
Authored by: Mike Lesser on Nov 15, '02 12:03:17AM

Is everybody sure that termcap is installed with the Dev CD? I have that installed, and I get the "ain't no termcap" message, and it's not installed (in /etc/ or anywhere else). This has confounded me for some time.....



[ Reply to This | # ]
More on Termcap
Authored by: bluehz on Nov 16, '02 08:51:42AM

Me too - no termcap here and I just did a clean install 10.2.2 and Developer Tools. No termcap warnings all the time...



[ Reply to This | # ]
no backspace in ssh'd screen...
Authored by: DMCrimson on Nov 18, '02 05:35:20PM

it results with ~and GOTO illegal value in irc...
the setting I used was xterm-color, xterm-16color yields name collision



[ Reply to This | # ]
Another way.
Authored by: Davidge on Dec 11, '02 07:00:25AM
If you've changed your terminal shell to bash rather than tcsh, you can enter the following in your ~/.bashrc file.
TERMINFO=/usr/share/terminfo TERM=color_xterm export TERMINFO TERM
You'll then get colour in lynx, dselect, etc. Remember, unless you enter the commands on the command line, you need to run:
sh ~/.bashrc
or logout from your terminal and start a new one. Dave

[ Reply to This | # ]
Simple Method + Screenshots
Authored by: Morgoth on Dec 16, '02 02:01:17AM
Here's my solution. It provides colour output for the 'ls' and 'vi' commands. It worked for me with the default command shell (tcsh) from Terminal. A couple of OSXGNU packages and two RC files is all I needed. My solution is designed for a single user, but it shouldn't be too hard to get it to adapt it to work for all users.

[ Reply to This | # ]