1

I read a bunch of instructions for installing bash-completion for git, and settled on the macport solution, which is, for example, mentioned here: How to get git-completion.bash to work on Mac OS X?

However, this does not work, and I must call source /opt/local/etc/bash_completion.d/git or put it in my .bashrc to activate git bash completion. Am I missing something? It seems like sourcing of a specific completion package should be more automatic, and no one on the web that I've found has listed this in their instructions for getting git bash-completion to work on mac os.

jonderry
  • 1,027

1 Answers1

6

MacPorts' bash-completion script is supposed to live at /opt/local/etc/bash-completion and take care of sourcing everything inside /opt/local/etc/bash-completion.d/*. However, it is not installed by default. You need to...

sudo port install bash-completion

...and then you still need to source /opt/local/etc/bash-completion from one of your bash startup scripts.

Note that the latest version of that script requires bash >= 4, which is later than is included with Mac OS X Lion 10.7.x (which includes bash 3.2.48(1)). Update: OS X Mountain Lion v10.8.0 still appears to ship with bash 3.2.48(1), so this step is still needed even on Mountain Lion. So make sure you've installed a later bash with MacPorts, and make sure you've configured Terminal.app (or whatever terminal you're using) to run /opt/local/bin/bash instead of OS X's default /bin/bash.

See also (recommended reading! good tips!): https://trac.macports.org/wiki/howto/bash-completion

Spiff
  • 110,156