macOS does not have Bash autocomplete feature installed and enabled by default as Linux distributions like Ubuntu. You will have to install and configure the bash-completion program for macOS to enable it, which is available via Homebrew.

bash-completion can be installed and enabled in macOS from the terminal.

Steps to enable bash completion in macOS:

  1. Launch Terminal.
  2. Install Homebrew by running the following commands.
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Install bash-completion via Homebrew.
    $ brew install bash-completion
  4. Manually enable bash-completion for current session.
    $ . /usr/local/etc/bash_completion
  5. Automatically enable bash-completion when launching a new shell session by adding the following lines to ~/.bashrc or ~/.bash_profile.
    [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
Discuss the article:

Comment anonymously. Login not required.