Bash – OSX bash terminal auto-completion – odd behavior on double tab

bashosxterminal

I am on OSX Sierra 10.12.6 and I am experiencing odd behavior in terminal windows.

When entering a command like cd ~/, I expect to press Tab twice quickly to see all path options. For example:

cd ~/

[double press tab]

cd ~/
.CFUserTextEncoding
.DS_Store
.Trash/
.account
.android/
.avn/
.avnrc
.babel.json
.bash_history
.bash_profile
...

Instead, I only see one path option at a time. Pressing Tab simply cycles to the next one:

cd ~/
[press tab]
cd ~/.CFUserTextEncoding
[press tab]
cd ~/.DS_Store
[press tab]
cd ~/.Trash/
...etc

Pressing Tab twice quickly simply does this twice.

This issue has remained constant through multiple OS updates. Does anybody know how to fix it?

Best Answer

It sounds like you have menu-complete, not complete, bound to the tab key. (Confirm with bind -P | grep menu-complete.) There are several ways this could have been activated:

  • C-i: menu-complete in your .inputrc file
  • bind 'C-i: menu-complete' in .bashrc or some other shell configuration file.

If you can find the offending line, remove it to restore the default binding to complete. If you can't, try adding C-i: complete to your .inputrc file to override the binding to menu-complete.

Related Question