Ad

Our DNA is written in Swift
Jump

My Terminal is Less Boring Than Yours

There’s a category of developers – probably coming from other Linux-based desktops – who are feeling at home in the console (aka terminal). Especially when working with SCM systems like Git or Subversion you’re often faster committing or updating doing that via short commands as compared to Xcode.

Unfortunately Apple did not think to make the console a nice thing to look at from the get go. Let me show you quickly how you can geek up your terminal as well. Your colleagues will be impressed.

It’s really simple. You need to add these lines to your .profile which resides in your user home directory. If the file does not exist, create it.

export CLICOLOR=1
export LSCOLORS=Gxfxcxdxbxegedabagacad

The first line activates color support for the CLI (command line interface), the second line specifies which colors to use for certain kinds of things. When this is set every new console window will emit special ANSI sequences to set the colors.

You also need to enable these colors for your terminal. Make sure you have set your terminal emulation to xterm-color in Preferences – Advanced in the Terminal app. While you are here you can also set up some other things for how the Terminal should be styled. I prefer the “Pro” style which has a tinted glass background, sort of like a holographic display which you can see through.

The above settings will make your terminal look like this:

If these colors are not your style, don’t fret, Geoff Greer has build a cool online generator to piece together the LSCOLORS code. Just make your own color finger print and paste it into your .profile.

There’s more! Git also sports several color options:

git config color.branch auto
git config color.diff auto
git config color.interactive auto
git config color.status auto

… or you use the catch-all setting which includes all of the above:

git config color.ui true

This adds splashes of colors here and there, for examples a git diff:

Many other tools also support a color option, for example viewing a command’s man page is so much more interesting with a touch of color. If you have additional suggestions on how to make better use of color in terminal please don’t hesitate to comment below.


Categories: Mac

3 Comments »

  1. I use a “framework” for bash called bash-it https://github.com/revans/bash-it

    You should give a try. It’s pretty cool, I use the theme called Tylenol

  2. Hi Oliver,
    If you like using git through the CLI, you’ll love to add this in one of your “dotfiles”

  3. Whoops, embedded Gists doesn’t work here.
    https://gist.github.com/1209387