Apple - Completion for git commands

A solution when switching from ubuntu is to use homebrew, a package manager for Mac OSX. In particular, for git, you will have included a number of additions including bash completion. This will be true for other programs which are faliliar for developpers, like make.

In 2 steps:

  1. install with ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
  2. Run brew doctor to get your path set up properly
  3. Install git and bash completion: brew install git bash-completion
  4. Add the command return in the previous step in your .bash_profile.
  5. Restart your bash sessions once the new tools and configuration are written to your file system.

More on this howto.


The easiest way to get autocompletion on OS X is to switch your shell to zsh.

  • Change default shell from bash to zsh

You can test things by running zsh in iTerm and terminal before making the switch above. If you really want to stick with bash you can start with these two questions:

  • Is there a way to auto-complete the open command in Terminal?
  • How can I make autocomplete in the shell work with case-folding?

I have two suggestions:

  1. use fish, it's really simple and easy

    a. extend it by using oh-my-fish

  2. zsh with oh-my-zsh. zsh is already installed so you don't need to do much.

    a. chsh -s /bin/zsh

    b. logout and login again

    c. execute this to install oh-my-zsh wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh more info here: https://github.com/robbyrussell/oh-my-zsh

I use oh-my-zsh but fish is great as well.