Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.)?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

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/.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.