Terminal prompt with git branch

The console of Mac OS X, is just like any unix console. It’s very powerful and can simply be customized over the preferences of the terminal application and by setting environment variables like *PS1*. So here is a picture of my current terminal.

As mentioned before, it is a combination of preferences and some variables. So here is my current setup a bit more detailed.

First of all the preferences of the terminal app. Here I changed mainly the text font and color. I think the ordinary settings are self explaining. You can start by duplicating an existing configuration over an option under the gear symbol and customize it. Mine is based on the *Pro*.

If you like it, you can download the configuration of MyOrangeTerminal.

To activate the new configuration for every new window, go to the *Startup* tab and select it under *On startup, open*.

The second is the environment variable *PS1* which should be specified in the file *~/.profile*, which will be automatically executed on each start. This definition includes a nice behaviour in interaction with git. As you may have seen in the first picture it shows the current branch of the git repository, if you in one. Crucial is that you have git installed and included the git *bash completion* which comes along with the git installer for Mac OS X.

More information about the meaning of the components in the *PS1* definition can be found in the article prompt magic. It mainly describes the colours and available variables that can be used in the *PS1* environment variable.