Bash Completion on Mac OS X

One of the many nifty features of bash is that it provides context-sensitive completion, but for some reason this capability isn’t part of the bash that ships with Mac OS X.

To rectify the oversight, first install the bash_completion port via MacPorts:

$ sudo port install bash-completion

And then modify your ~/.profile as directed, e.g., by adding:

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

To load the collection of completion hooks, create the symlink ~/.bash_completion.d

$ ln -s /opt/local/etc/bash_completion.d/ ~/.bash_completion.d 

Next, above the other block added to ~/.profile, add:

export USER_BASH_COMPLETION_DIR=~/.bash_completion.d

If you want use git-completion hooks, simple install from ports git-core with bash completion hooks

sudo port install git-core +bash_completion
$ git[TAB]
add                 init 
am                  instaweb 
annotate            log 
apply               merge 
archive             mergetool 
bisect              mv 
blame               name-rev 
branch              notes 
bundle              pull 
checkout            push 
cherry              rebase 
cherry-pick         reflog 
citool              relink 
clean               remote 
clone               repack 
commit              replace 
config              request-pull 
describe            reset 
diff                revert 
difftool            rm 
fetch               send-email 
filter-branch       shortlog 
format-patch        show 
fsck                show-branch 
gc                  stage 
get-tar-commit-id   stash 
grep                status 
gui                 submodule 
help                tag 
imap-send           whatchanged 



coded by nessus