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
add comment

1 Answer

The easiest way is to install bash_completion from homebrew and folow the instructions. Here is the output:

$ brew install bash-completion
==> Downloading http://bash-completion.alioth.debian.org/files/bash-completion-1.3.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/bash-completion/1.3
==> make install
==> Caveats
Add the following lines to your ~/.bash_profile file:
  if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
  fi

To install Homebrew's own completion script:
  ln -s "/usr/local/Library/Contributions/brew_bash_completion.sh" "/usr/local/etc/bash_completion.d"
==> Summary
/usr/local/Cellar/bash-completion/1.3: 185 files, 1.0M, built in 4 seconds

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

share|improve this answer
add comment

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.