Ant is already installed on some older versions of Mac OS X, so you should run ant -version to test to check if it is already installed before attempting to install it. For MacOS Mavericks (10.9 and perhaps later versions too), Apache Ant does not come bundled with the operating system and so must be installed manually.
You can use brew to easily install ant. Simply execute the following command in a terminal window to install brew:
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
It may take a while to download and install. If you already have brew installed, make sure to update it by executing below command
Once brew is installed you can use below command to install ant
brew install ant
Ant will be installed and
ant command will be available in the command in the terminal.
To test the installation, just type “ant -version” into a terminal window. You should get the following output:
Apache Ant(TM) version 1.9.4 compiled on April 29 2014