Ant is already installed on Mac OS X, and so it is not necessary to install it yourself. If you absolutely want to install it, though, the best way would be to install it through MacPorts (using sudo port install apache-ant
), however, to install it manually, you would need to:
- Decompress the .tar.gz file (why did you move it before untarring it?)
- Optionally put it somewhere.
- Put the "bin" subdirectory in your path.
The commands that you would need, assuming apache-ant-1.8.1-bin.tar.gz
were still in your Downloads directory, would be the following (explanatory comments included):
ant --version # Demonstrate builtin version
cd ~/Downloads # Let's get into your downloads folder.
tar -xvzf apache-ant-1.8.1-bin.tar.gz # Extract the folder
sudo mkdir -p /usr/local # Ensure that /usr/local exists
sudo cp -rf apache-ant-1.8.1-bin /usr/local/apache-ant # Copy it into /usr/local
# 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
# Demonstrate new version of ant
ant --version