I just followed the instructions @ this question in order to get git autocompletion in the terminal. Here are the steps I've undertaken:
port install bash-completion
-
Added
if [ -f /opt/local/etc/bash_completion ]; then . /opt/local/etc/bash_completion echo "bash completion loaded" fi
to my ~/.profile
-
port update git-core +svn +bash_completion +doc
Then I restarted the terminal, it showed me "bash completion loaded" so obviously the file exists, but the tab-completion still only works on files. Nothing magical happening after typing git
and then hitting tab.
I examined /opt/local/etc/bash_completion.d/
and it gives me 149 files including
git
, java
, man
, port
. I tried typing those commands and then hitting tab but nothing worked there either.
Does anyone have an idea what I did wrong? Maybe I messed up a environment variable or something. Can anyone who has bash-completion install tell me a command where it should work , like port up
and then hit tab –> port upgrade
.
Thanks 😉
Edit:
Found another link that describes my approach: How to get git-completion.bash to work on Mac OS X?
Best Answer
For me in
tmux
it worked, but in plain iTerm2 not. Solution was setting the Command to/opt/local/bin/bash -l
for my used iTerm2 profile. I found the solution at https://trac.macports.org/wiki/howto/bash-completion