Installing Apache Ant on MAC is quite different from Windows.
We use Terminal instead of cmd prompt in MAC.
Steps to Install Apache Ant on MAC OS X:
1. Download the latest version of Apache Ant.
2. Open the Terminal application.
3. Now you’ll need to manipulate files in the /usr/local/ which means you’ll need root privileges. To get them use “sudo” command (lucky you are, Mac OS X already has sudo as well) and enter your root password.
sudo sh
System_name:~ Username$ sudo sh
Password:
sh-3.2$
4. Move/Copy the archive into /usr/local/:
mv apache-ant-1.8.4-bin.tar.gz /usr/local/
5. Go to /usr/local/:
cd /usr/local/
sh-3.2$ cd /usr/local/
6. Unarchive the sources:
tar xvzf apache-ant-1.8.4-bin.tar.gz
sh-3.2$ tar xvzf apache-ant-1.8.4-bin.tar.gz
7. Change the apache-ant-1.8.4 directory owner to your normal user:
chown YourUsername:YourGroup apache-ant-1.8.4
If you’re not sure about the username and the group simply type “ls –la”. This command will print out all files and directories in the current directory (/usr/local/). The Ant sources you just copied will have your username and your group:
-rw-r--r--@ 1 Sams staff 5425171 12 Feb 15:24 apache-ant-1.8.4-bin.tar.gz
sh-3.2# ls -la
total 10600
drwxr-xr-x 5 root wheel 170 Feb 12 16:05 .
drwxr-xr-x@ 11 root wheel 374 Dec 29 19:47 ..
drwxr-xr-x@ 14 root wheel 476 Feb 12 16:05 apache-ant-1.8.4
-rw-r--r--@ 1 user_name staff 5425171 Feb 12 15:24 apache-ant-1.8.4-bin.tar.gz
drwxr-xr-x 4 root wheel 136 Dec 29 19:47 bin
8. Now you can run Ant by typing /usr/local/apache-ant-1.8.4. Not very convenient, huh?
9. Let’s make it work more friendly:
First, create a symbolic link to refer the application as ant instead of apache-ant-1.8.:
ln -s apache-ant-1.8.4 ant
sh-3.2# ln -s apache-ant-1.8.4 ant
Second, add the following lines into your shell config:
export ANT_HOME_DIR=/usr/local/ant
export PATH=${PATH}:${ANT_HOME_DIR}/bin
sh-3.2# export ANT_HOME_DIR=/usr/local/ant
sh-3.2# export PATH=${PATH}:${ANT_HOME_DIR}/bin
sh-3.2#
10. Restart your Terminal and type “ant”. If it says “Buildfile: build.xml does not exist! Build failed” which means that Apache Ant works correctly.
Else open terminal and type,
ant -version
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteBig Data Hadoop training in electronic city
Python Training in electronic city
DataScience with Python Training in electronic city
AWS Training in electronic city
Big Data Hadoop Training in electronic city
Devops Training in electronic city
blockchain Training in electronic city
Hibernate Training in electronic city
Data science Training in Electronic City
Selenium with python Training in Electronic City