I am setting up my old MacBook, reclaimed from my housemate, to be usable for the programmings.

The first step was to install homebrew. I'm finding it a bit friendlier than macports, which seems to be irretrievably broken on the other MacBook.

After a few more steps (git, mercurial, node, rabbitmq of course), I found myself missing my pretty hg-prompt bash prompt. But I'm working with git much more these days, so I wondered if there was something that could do both.

There is: vcprompt, and what do you know it's in homebrew.

$ brew install vcprompt

To get the pretty prompt, I more or less transcribed what I had from hg-prompt. In .bashrc:


vc_ps1() {
    vcprompt -f "(%n:${PINK}%b${D}${GREEN}%u%m${D})" 2>/dev/null

export PS1='${GREEN}\[email protected]\h${D} in ${ORANGE}\w${D}$(vc_ps1)\n$ '

By the way, if like me you forget which of .bashrc and .bash_profile is for what, this post explains it.

If you want to get fancy, there's a guide to customising the bash prompt on the Arch Linux wiki.

One Response to “Prompt-a-licious”

  1. Mark Aufflick Says:

    FYI here are the colours I use for a white background terminal:

    D=$'e[0m' BLUE=$'e[34m' PURPLE=$'e[1;35m' CYAN=$'e[0;31m'

    vc_ps1() { vcprompt -f "(%n:${PURPLE}%b${D}${CYAN}%u%m${D})" 2>/dev/null }

    export PS1='${BLUE}[email protected]${D} in ${BLUE}w${D} $(vc_ps1)n$ '