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:
- Download latest Ant build from: http://ant.apache.org/bindownload.cgi
- Check previous version of ant on your mac
ant --version - Go to your downloads folder or folder where you downloaded Ant bundle.
- Extract the bundle
tar -xvzf apache-ant-1.8.1-bin.tar.gz - Ensure that /usr/local exists; if not found can be created by
sudo mkdir -p /usr/local - Copy it into /usr/local
sudo cp -rf apache-ant-1.8.1-bin /usr/local/apache-ant - Add the new version of Ant to current terminal session
export PATH=/usr/local/apache-ant/bin:"$PATH" - Add the new version of Ant to future terminal sessions
echo 'export PATH=/usr/local/apache-ant/bin:"$PATH"' >> ~/.profile