How to setup Apache ANT tool in Mac OS for Salesforce?

1. Download Apache Ant version 1.6 or newer to a directory of your choice-

2. Log into a Salesforce organization.

3. From Setup, click Develop --> Tools and select Migration Tool.

4. Save the .zip file locally and extract the contents to the directory of your choice.

5. Copy ant-salesforce.jar and paste into your Ant installation's lib directory. The lib directory is located in the root folder of your Ant installation.

6. Execute the below command in Terminal.

vim .profile

7. Press "i" key, so that you will be in Insert mode.

8. Paste the below code

export JAVA_HOME=$(/usr/libexec/java_home)
export ANT_HOME=/Users/magulanduraipandian/Desktop/Magulan/Ant
export PATH=$PATH:$ANT_HOME/bin

9. Do the same for vim .bash_profile Press "Esc" key.

10. Enter :wq and press "Enter" key.

11. Go to the path using "CD" command. For example, cd Desktop/Magulan/Ant/bin and execute the ant commands.

If you face ant command not found issue, please close the terminal and open it again.