How to enable Maven autocomplete on Mac OS X command-line? When using Maven (mvn) on OS  X Terminal, how can I get tab-completion for Maven goals, plugin names, etc? Things like this:

mvn pa [TAB] -&gt; mvn package

mvn je [TAB][TAB] -&gt; mvn jetty:run
Maven doesn't ship with an auto-complete script, but there's a project on GitHub called Maven Bash Completetion. 

Installation if you use Homebrew: 


brew tap homebrew/completions
brew install maven-completion


Otherwise, use this command to download the latest script (to your home directory as ~/.maven-completion.bash): 

wget https://raw.github.com/juven/maven-bash-completion/master/bash_completion.bash \
    -O ~/.maven-completion.bash


Then add this to your ~/.bash_profile:

if [ -f ~/.maven-completion.bash ]; then
  . ~/.maven-completion.bash
fi


You can also manually copy the file from the github repo to your home directory and edit your bash profile as above should the homebrew or wget options not work for you.

That's it. After you restart bash (e.g. open a new Terminal window), Maven autocomplete should work.