- Make sure you have Homebrew installed, and then use it to install the package bash-completion (by typing the command
brew install bash-completion
). - Homebrew should now tell you what you need to do to complete the installation. In this case, you need to add these three lines to your
.bashrc
file (using either a command-line text editor like nano which we used above, or a graphical one):
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
-
You should now have auto-completion in bash. Please note: for the changes to take effect in existing shells, .bashrc will need to be sourced. Alternatively, logout and login again, or just reboot.
-
To disable it, all you need to do is remove the lines we added above, and run the command
brew uninstall bash-completion --force
.