ant: Command not found | Mac Os X

ant: Command not found

You see this message while using ant command if you do not have ant installed on your machine or it's path is not properly set in environment variables.

To install ant on Mac you need to follow these steps:

1. Download ant zip (.gz) file from  http://ant.apache.org/bindownload.cgi

2. Double click and unzip it.

3. Move it to /opt/ or /usr/local/ using this command

mv /Users/admin/Downloads/apache-ant-1.9.4  /opt/

mv /Users/admin/Downloads/apache-ant-1.9.4  /usr/local/

4.  Next we are going to set environment variables.
nano $HOME/.profile

This will open an editor

Type these 3 lines
export PATH=$PATH:/usr/local/ant/bin/
export ANT_HOME=/usr/local/ant
export  JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0._71..jdk/Contents/Home/bin

Hit Ctrl+O to write

Then hit Ctrl+X to close editor

5. Load variables by executing this command
source $HOME/.profile

6. try this command and that's it...
ant -version

Recent Posts