Tab Completion in OSX

Tab Completion in OSX

Since I started to use mac at work I have missed some of the nice features that you have in Linux like tab completion in bash. It is quite easy to setup in OSX.

You need to install Homebrew if you don’t allready have it. It’s a package manager for OS X like you can find in Linux.

http://mxcl.github.com/homebrew/

1. Install git and bash-completion:
    brew install git bash-completion

2. Add bash-completion to your .bash_profile
# Set git autocompletion and PS1 integration
if [ -f brew --prefix/etc/bash_completion ]; then
    . brew --prefix/etc/bash_completion
fi

GIT_PS1_SHOWDIRTYSTATE=true

PS1='\[\e[1;37m\]\[\e[1;32m\]\u\[\e[0;39m\]@\[\e[1;36m\]\h\[\e[0;39m\]:\[\e[1;33m\]\w\[\e[0;39m\]\[\e[1;35m\]$(__git_ps1 " (%s)")\[\e[0;39m\]\[\e[1;37m\]\[\e[0;39m\]$ '

To test it directly you can write:
    source .bash_profile

Now you should be able to use tab completion.