I tried to install Apache Ant on my Mac and I followed the next steps :
apache-ant-1.8.1-bin.tar.gz
into my Downloads folder.To get Ant running on your Mac in 5 minutes, follow these steps.
Open up your terminal.
Perform these commands in order:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ant
If you don't have Java installed yet, you will get the following error: "Error: An unsatisfied requirement failed this build."
Run this command next: brew cask install java
to fix this.
The installation will resume.
Check your version of by running this command:
ant -version
And you're ready to go!
MacPorts will install ant for you in MacOSX 10.9. Just use
$ sudo port install apache-ant
and it will install.
If you have MacPorts installed (https://www.macports.org/), do this:
sudo port install apache-ant
The only way i could get my ant version updated on the mac from 1.8.2 to 1.9.1 was by following instructions here
http://wiki.eclipse.org/Ant/User_Guide
Ant is already installed on some older versions of Mac OS X, so you should run ant -version
to test if it is installed before attempting to install it.
If it is not already installed, then your best bet is to install Homebrew (brew install ant
) or MacPorts (sudo port install apache-ant
), and use those tools to install Apache Ant.
Alternatively, though I would highly advise using Homebrew or MacPorts instead, you can install Apache Ant manually. To do so, you would need to:
The commands that you would need, assuming apache-ant-1.8.1-bin.tar.gz
(replace 1.8.1 with the actual version) were still in your Downloads directory, would be the following (explanatory comments included):
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
# Verify new version of ant
ant -version
Use Brew is always good way to install ANT and other needs. To install type below command on terminal.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
after Brew installation , type
brew install ant
This will install Ant on your system. Also you will not need to worry about setting up the path.
Also i have documented on the same - How to Install ANT on Mac OS?