Bash-Completion Mac OS X

2010/05/04

Just a quick note on how to turn on Bash-Completion on Mac OS X. Bash-Completion is a set of scripts that is essentially auto-complete on steroids. The benefits of this is that when you go to auto-complete on a make file or ant build file auto-complete will search the build file for the  build targets and list them instead of/ aswell as the files within the cwd. For a while now this has been included by default in most bash setups but not for Mac OS X. To install:

  1. Assuming you have Mac Ports installed:

    $ sudo port install bash-completion

  2. Add the following to your ~/.profile file.

    if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion
    fi

  3. Open a new terminal and then enjoy!