Enable bash completion on Mac OS X

March 7, 2016 by

If you’re frequently using bash completion for SSH or other things on Linux, it’ll probably frustrate you to no end that it doesn’t work out of the box on a Mac. However, it’s rather easy to fix. Just install it using Homebrew (assuming you have brew installed already):

brew install bash-completion

The make sure your ~/.bash_profile will load bash_completion for you:

vi ~/.bash_profile

In the file, add:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion

Now reload (source) your .bash_profile and you should be good to go:

. ~/.bash_profile

Leave a Reply