how do I get colored output in Terminal.app

hgreenfi

Registered
I imagine that this is a silly question, but I can't seem to figure it out. I love the colored output in my linux terminals and would like the same on my mac. I have seen several references to turning this feature on in jaguar, but no clear instructions. Any body willing and able to help?

Thanks :)
 
It's on by default. Check the checkbox in one of the window setting options to enable ANSI color. Also, you need to have your TERM environment set to a value that support color. Depending on the system you're on, this could be many things. I always use 'dtterm' as my terminal type. If that doesn't exist, try 'ansi'. Basically if the shell you're currently using is set to a TERM that doesn't support color, it won't send the color control characters to your terminal to display.

Brian
 
I was using dtterm because of mutt, but find that rxvt works better. Terminal finally supports line drawing!
 
I must be feeling slow this afternoon.

In Terminal window settings color just below the transparency slider bar there is a check box labeled "disable ANSI color" it is not selected by default. I am running tcsh as my shell. Tried setenv TERM dtterm, setenv TERM rxvt, setenv TERM ansi and the equivalent exports in bash to no avail. I also for the heck of it tried selecting the disable ANSI color checkbox. ls -l in my terminal is still just one color. What I woud like is to see distinct colors for directories, files, executeables etc. I love unix cause once you think you know just a little bit, it laughs at you and proves you wrong :)
 
Well, for starters to see color in ls, you need an ls that supports colors :) There are a bunch of packages out there with color ls for OS X. ls by default doesn't use colors, never has, never will (unless you're using some stupid linux distro that loves to do really stupid things, but thats linux for you, stupid stupid stupid). Just do a search for "color ls os x" on google and you'll get a bunch of links. Also, DO NOT replace the normal system ls with color ls, rename color ls to something like lsc and make an alias for ls to call lsc like: alias ls '/bin/lsc --color -a' It's just really bad practice to replace system binaries with 3rd party ones as they may have some command line differences and other funness.

Brian
 
What I usually do is install my own stuff into /usr/local and put /usr/local/bin before the rest in my path, so the system installed stuff in /usr is still there.
 
One thing to remember when putting something before /bin and /usr/bin in your path is it can cause issues with folks who write bad shell scripts (ie. they don't put in full path names for commands). For instance, a long time ago I had to deal with HP LaserJet drivers in which the person used "echo" without a full path. The "echo" that was being used expected arguments that worked for the SVR4 version of "echo", and I had a BSD version of "echo" first in my path. So, basically, if you booted the machine the printer would print fine. If I stopped and restarted the print daemon, it wouldn't print. After dealing with that issue for a couple weeks I never again put anything before /bin:/usr/bin:/sbin:/usr/sbin in my path. Ofcourse your milage may vary, but I always play it safe, as badly written shell scripts can cause you a world of hurt if they don't get what they expect.

Brian
 
Brain and hazmat thanks for your help :) I knew it had to be simple once I figured out what question I really needed to ask. I googled for "color ls os x" and came up with several options. Picked one and it does what I want. Appreciate your help.
 
Back
Top