To install bash-completion on a Mac, you will first need to have the Homebrew package manager installed. If you don’t have it, you can install it by running the following command in the terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once you have Homebrew installed, you can use it to install bash-completion by running the following command:
brew install bash-completion
You will then need to add the following line to your ~/.bash_profile file:
[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"
After you have done this, restart your terminal and bash-completion should be working.
This article is created based on experience but If you discover any corrections or enhancements, please write a comment in the comment section or email us at contribute@devopsforu.com. You can also reach out to us from Contact-Us Page.
Follow us on LinkedIn for updates!