12

I work in the terminal a fair bit, and one thing I really miss from the servers I usually work on is the comprehensive autocompletion bash provides on Ubuntu servers.

Are there any readymade tools that will add a similar level of completion to my Mac; containing at the very least command line arguments for built-in system utilities and developer tools (like git, xcodebuild, etc.)?

14

The easiest way is to install bash-completion from homebrew and follow the provided instructions.

Example output:

==> Downloading https://homebrew.bintray.com/bottles/bash-completion-1.3.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring bash-completion-1.3.mavericks.bottle.tar.gz
==> Caveats
Add the following lines to your ~/.bash_profile:
    if [ -f "$(brew --prefix)/etc/bash_completion" ]; then
        source "$(brew --prefix)/etc/bash_completion"
    fi

The Homebrew bash completion script has been installed to:
    /usr/local/etc/bash_completion.d

Bash completion has been installed to:
    /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/bash-completion/1.3: 188 files, 1.1M

Once you are done, you can create your own scripts under /usr/local/etc/bash_completion.d/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .