Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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] -> mvn package

mvn je [TAB][TAB] -> mvn jetty:run
share|improve this question
I don't use maven, but is there not a bash-completion option on the Macports install? – Clayton Stanley Apr 18 '13 at 7:04
@ClaytonStanley: Not sure, but I doubt it, since Maven default distribution doesn't come with it. I installed Maven with Homebrew; no bash-completion out of the box. – Jonik Apr 18 '13 at 7:32
up vote 7 down vote accepted

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:

  1. brew tap homebrew/completions
  2. brew install maven-completion

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

wget \
    -O ~/.maven-completion.bash

Then add this to your ~/.bash_profile:

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

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.

share|improve this answer

Your Answer


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.