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

Follow these steps at the Terminal to have autocomplete feature in Bash for your macOS:

  1. Install Homebrew by running the following commands.
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install bash-completion via Homebrew.
    $ brew install bash-completion
  3. Manually enable bash-completion for current session.
    $ . /usr/local/etc/bash_completion
  4. 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:

Share your thoughts, suggest corrections or just say Hi. Login not required.

Share!