BuySellAds.com

Read the chapters in my new book Barcodes with iOS 7 as I hand them in. Great new app opportunities await!
Our DNA is written in Objective-C
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

%d bloggers like this: