Can I make my Mac OS X Terminal color items according to syntax, like the Ubuntu terminal?

I want it to have all the colors for syntax folders, etc... How can I do that?


Solution 1:

My terminal colors

terminal color examples

how to do it

download theme

from here: http://media.tannern.com/tanner.terminal

import into Terminal

After installing SIMBL and the correct terminalcolors you can import my terminal theme from the Terminal Preferences window.

where to find the import option

other tweaks

Adding this to the file ~/.profile will make ls color it's output by default.

# Make ls use colors
export CLICOLOR=1
alias ls='ls -Fa'

Adding this will define colors as variables to make a prompt easier to edit.

# define colors
C_DEFAULT="\[\033[m\]"
C_WHITE="\[\033[1m\]"
C_BLACK="\[\033[30m\]"
C_RED="\[\033[31m\]"
C_GREEN="\[\033[32m\]"
C_YELLOW="\[\033[33m\]"
C_BLUE="\[\033[34m\]"
C_PURPLE="\[\033[35m\]"
C_CYAN="\[\033[36m\]"
C_LIGHTGRAY="\[\033[37m\]"
C_DARKGRAY="\[\033[1;30m\]"
C_LIGHTRED="\[\033[1;31m\]"
C_LIGHTGREEN="\[\033[1;32m\]"
C_LIGHTYELLOW="\[\033[1;33m\]"
C_LIGHTBLUE="\[\033[1;34m\]"
C_LIGHTPURPLE="\[\033[1;35m\]"
C_LIGHTCYAN="\[\033[1;36m\]"
C_BG_BLACK="\[\033[40m\]"
C_BG_RED="\[\033[41m\]"
C_BG_GREEN="\[\033[42m\]"
C_BG_YELLOW="\[\033[43m\]"
C_BG_BLUE="\[\033[44m\]"
C_BG_PURPLE="\[\033[45m\]"
C_BG_CYAN="\[\033[46m\]"
C_BG_LIGHTGRAY="\[\033[47m\]"

Adding this will give you a multi-line colored prompt.

# set your prompt
export PS1="\n$C_LIGHTGREEN\u$C_DARKGRAY@$C_BLUE\h $C_DARKGRAY: $C_LIGHTYELLOW\w\n$C_DARKGRAY\$$C_DEFAULT "

For a list of escape sequences to use in prompts check this article

Solution 2:

geekology.co.za has an informative blog post on how to do this, "Enabling Terminals directory and file color highlighting in Mac OS X". In case it gets moved or deleted, the basics are:

Add to your .bashrc or .profile:

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

Save the file. Open a new terminal and use

ls
ls -l
ls -la
ls -lah

The rest of the article has info on what the colors do and how to change them (the letters you assign to LSCOLORS is what controls what colors you see).

Solution 3:

As of Mac OS X Lion 10.7, Terminal allows you to customize the sixteen ANSI colors and also supports the 256-color palette.

So, installing SIMBL or other extensions to get more colors is no longer necessary.

Solution 4:

People may want to check out zsh + prezto. There's a nice guide here. zsh is already installed in OSX. Prezto just adds stuff to your shell. Activate the syntax-highlighting module, and go to town :)