Installing or Upgrading Ant in Mac OSX

First of all Ant already come with Mac OSX, but if you really need to install it or want to upgrade it, though, the best way would be to install it through MacPorts (using sudo port install apache-ant). To install it manually you can follow these simple steps:
  1. Download latest Ant build from: http://ant.apache.org/bindownload.cgi
  2. Check previous version of ant on your mac ant --version
  3. Go to your downloads folder or folder where you downloaded Ant bundle.
  4. Extract the bundle tar -xvzf apache-ant-1.8.1-bin.tar.gz
  5. Ensure that /usr/local exists; if not found can be created by sudo mkdir -p /usr/local
  6. Copy it into /usr/local sudo cp -rf apache-ant-1.8.1-bin /usr/local/apache-ant
  7. Add the new version of Ant to current terminal session export PATH=/usr/local/apache-ant/bin:"$PATH"
  8. Add the new version of Ant to future terminal sessions echo 'export PATH=/usr/local/apache-ant/bin:"$PATH"' >> ~/.profile
Now check new version of ant on you mac.