Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I configure Mac Terminal to have color ls output? I am using MacOS 10.5

share|improve this question

migrated from Dec 14 '11 at 4:40

This question came from our site for professional and enthusiast programmers.

This is a great question... I've always expected ls --color (a la gnu ls) to just work everywhere. MacOS doesn't accept --color, so I assumed that it didn't have colored output as an option at all. – Armentage May 1 '11 at 16:35





and add the following two lines:

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

you can use this if you are using a black background:

export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
share|improve this answer
Or gxBxhxDxfxhxhxhxhxcxcx on black background – Mikulas Dite Jul 16 '10 at 17:51
I'm using LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd" to emulate the default colouring on the linux ls command – Jamie Cook Dec 21 '13 at 13:52
Thanks Jamie, this is just what I needed, I really wanted to keep default colouring. – janko-m Mar 10 '14 at 16:48
This answer could benefit from some additional details. e.g., the difference between the two environment variables, and pointing out that all you really need to do is set CLICOLOR to enable colors in ls. Setting LSCOLORS is only necessary if you want to customize the colors/attributes. – Chris Page Mar 20 '15 at 4:45
For the creative people, you can devise your own color scheme with this online tool – Nov 13 '15 at 3:53

You can add

alias ls='ls -G'

to your ~/.bash_profile to get colored ls output.

share|improve this answer
Mine is alias ls="ls -Gp" — the -p adds a slash after each directory. For me, it provides that much more visual differentiation, which is helpful. – Quinn Taylor Jun 12 '09 at 15:40
I see your -p and raise you a -F which in addition puts an * after executables, | after pipes, @ after symlinks, et cetera. – aib Dec 27 '10 at 18:57
Just for fun, throw in a -h, which will format sizes in "human readable" units, i.e. 100b 10k, 23m, 4.2g – Armentage May 1 '11 at 16:29
If you don't have a .bash_profile already at ~/.bash_profile, be sure to source it, so that it will work. Do this with "source ~/.bash_profile" – y3sh Jul 28 '11 at 18:00
Dunno if this has changed since 2011, but you can replace the alias with export CLICOLOR=1 to accomplish the same thing. – David Lord May 31 '15 at 11:47

If you want a readable mac os x terminal color scheme, you may want to look into this:

and the version for Lion:

I've been using this for over a year now, and I might not be able to function without it!

share|improve this answer
As of Mac OS X Lion 10.7, Terminal allows customizing the ANSI colors, so using SIMBL or other extensions is no longer necessary. It also supports 256 colors. – Chris Page Sep 4 '11 at 8:59

I find that all I need really is adding this to my ~/.bash_profile

export CLICOLOR=1
share|improve this answer
Or ~/.bashrc. – Chris Page Aug 6 '15 at 4:52
doesn't appear to work on capitan ): – drevicko Jul 18 at 9:42

Also you can customize the prompt color (and its format) by adding:

PS1='\[\e[0;33m\]\h:\W \u\$\[\e[m\] '

to ~/.bash_profile or ~/.profile file. Where 0;33 is regular yellow which looks nice in my black/semitransparent terminal window.

Here is a full list of colors and their explanations:

My awesome terminal window

share|improve this answer
It's useful! Thx! – Kjuly Sep 16 '12 at 8:23

Another option is to use the GNU ls which is part of the 'coreutils' program.

You can get it via Rudix or Homebrew (brew info coreutils)or Macports or Fink. That might be preferable to using a "Mac OS X-only" solution if you use the same shell config files on different systems, or are already familiar with GNU ls.

share|improve this answer

Personally, I'm using Oh My Zsh for adding color and other tricks to my Terminal. I think that is the easiest way.

oh-my-zsh is an open source, community-driven framework for managing your Zsh configuration.

It comes bundled with a ton of helpful functions, helpers, plugins, themes, and a few things that make you shout…

share|improve this answer

Forget all those decades-old cryptic codes for gosh sakes, use the built in Terminal --> Preferences... Settings pane to set the default skin, and edit the ANSI colors to your liking. You can set the font, too. I prefer Menlo 12pt. This is how any regular Joe can do it, and avoid all the crazy command-line, unix-esque way of doing things as other posters have suggested.

share|improve this answer
I think anybody experienced enough to even know that ls can have colored output is also able to run a few Unix commands to configure it correctly. – patrix Sep 21 '12 at 21:35
+1 for pretty much perfect irony. – Dan J Sep 21 '12 at 22:02
But this just makes ls show in one colour it does not make links, directories, files show in different colours as ls can do – Mark Sep 25 '12 at 12:29
@geoffhoffman be trollin' yall – Jamie Cook Dec 21 '13 at 13:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.