My OSX Terminal Prompt (Reposted from Tumblr)

I wanted to post this on LosTechies, originally, but I didn’t have a good blogging tool at the time. I’m using MarsEdit now, and it seems to do what I want… but I digress…


My OSX Terminal Prompt

I made a few very minor tweaks to my OSX prompt after posting the previous screen shot on Tumblr. There’s not a lot of difference, here, but I also wanted to include the PS1 export in case others want to use it (by request of @rkitson)

My OSX Prompt

The first thing to note is that there is a blank line after the last command and before the current location / status indicators.

The first section, in white, is the current folder. I added a trailing / to this. Makes it easier to understand when your at the root folder or at ~/

The second section, in green, shows the current branch and status of a git repository. This is built into git, which is cool. No more parsing out git status messages. I haven’t quite figured out all of the symbols for this, but here’s the ones I do know:

  • “=” is for a tracking branch, and says current commit is same as remote
  • “>” is also for a tracking branch, and says current commit is forward of remote
  • “<” is also for a tracking branch, and says current commit is behind remote
  • “*” is for local changes that are not yet committed
  • “%” I don’t remember what this is for

The prompt combines these symbols in various ways. For example, “=*” says local changes not committed, but most recent commit is same as remote. This section hides itself when you’re not in a git repository.

The third section, in red, shows the RVM ruby version and gemset that is currently being used. This is built into RVM, as well. Just have to specify which options you want (and I don’t remember what the options mean off-hand). This section hides itself when you’re not using any specific version of ruby, with RVM.

Finally, I drop to a new line before putting “$ ” – yes, with a space – as my prompt. This keeps the prompt at the same place on the screen at all times.

… and not shown in this screen shot, I set the title bar of the terminal to “username@machinename”


The PS1 Settings For This Prompt

For those that are interested, here’s the PS1 setting for this:

function prompt {

local LIGHT_RED=”[33[1;31m]“
local LIGHT_GREEN=”[33[1;32m]“
local NO_COLOUR=”[33[0m]“

local TITLEBAR=’[33]0;u@h07]’

source ~/.git-completion.bash


PS1=”$TITLEBARnw/$LIGHT_GREEN$(__git_ps1 ‘ (%s)’) $LIGHT_RED$(~/.rvm/bin/rvm-prompt i v g)n$NO_COLOUR$ “


#call the prompt function to set things in motion

About Derick Bailey

Derick Bailey is an entrepreneur, problem solver (and creator? :P ), software developer, screecaster, writer, blogger, speaker and technology leader in central Texas (north of Austin). He runs - the amazingly awesome podcast audio hosting service that everyone should be using, and where he throws down the JavaScript gauntlets to get you up to speed. He has been a professional software developer since the late 90's, and has been writing code since the late 80's. Find me on twitter: @derickbailey, @mutedsolutions, @backbonejsclass Find me on the web: SignalLeaf, WatchMeCode, Kendo UI blog, MarionetteJS, My Github profile, On Google+.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • For some reason on my system it’s not:




    Great post though, thanks.

  • jauco

    “%” is untracked files
    “$” is stash exists
    “+” is staged changes
    “*” is unstaged changes

  • There is a prerequisite for git to provide bash_completion:

  • I am little wrong misleading with the prerequisite, that link describes how you get the git-completion.bash through `port`.

    If you have the git source you can retrieve the bash file from a git tar

    $ cp git-X-X-X/contrirb/completions/git-completion.bash ~/,git-completion.bash