Ant bash completion on Mac OS X

bash will do tab-completion for ant targets on Debian/Ubuntu boxes out-of-the-box. If you haven’t upgraded lately, you may need to:

sudo apt-get install bash-completion

On Mac OS X, it needs a bit of massaging. First install the macports version of bash-completion and ant:

sudo port install bash-completion apache-ant

Then add this to the end of your ~/.bashrc:

if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
complete -C /opt/local/share/java/apache-ant/bin/complete-ant-cmd.pl ant

See http://marius.scurtescu.com/2005/03/23/ant_bash_completion for Windows instructions.

Related posts:

  1. Apache2, PHP, and MySQL on Mac OS X using MacPorts
    1. Install MacPorts Follow the instructions here: http://www.macports.org/install.php. 2. Install apache2 sudo port install apache2 Note that the macports instructions suggest installing the launchctl script now, but we’ll do that......
  2. Installing git with MacPorts
    The Good: MacPorts makes git, the new source version control system hotness, available to Mac users. The Bad: MacPorts sometimes has attitude, and poops out trying to compile or install......
  3. How to set up native subversion (javahl) with Subclipse on Mac OS X
    Note that this is for Ganymede (Eclipse 3.4.x). Install the javahl binding with MacPorts: sudo port install subversion +bash_completion sudo port install subversion-javahlbindings Run eclipse, and add this upgrade site:......
  4. Switching between Rails 2 and Rails 3 on Mac OS X or Ubuntu with RVM
    I’m migrating AdGrok to Rails 3 this weekend–what with the new ActiveRecord query functionality, and MongoMapper, and all our gems migrating to Rails 3, it seems like it’s time. The......

  • http://johan.rylander.cc Johan Rylander

    ant is built in if you installed the Apple dev tools:

    sudo port install bash-completion
    
    if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion
    fi
    complete -C /usr/share/ant/bin/complete-ant-cmd.pl ant
    

    for the build int command.