1. Go to the official website to download the compressed package ( Apache Ant - Binary Distributions ).
2. Unzip the downloaded zip package to the root directory of mac
3. First create a .bash_profile file and start the terminal
Type touch .bash_profile
4. Start writing environment variables into the file, enter the command line vim ~/.bash_profile, and then press i to enter the editing mode.
5. Sometimes you will encounter an error as shown in the figure below. At this time, enter E, and then enter i to enter the edit mode.
6. Enter the following command line (feifei is the name of your own mac, remember to replace it with your own)
export ANT_HOME=/Users/feifei/apache-ant-1.10.12/bin
ANT_HOME=/Users/feifei/apache-ant-1.10.12
PATH=$PATH:$HOME/bin:$ANT_HOME/bin
export ANT_HOME PATH
7. Press the ESC key and enter: wq to save.
8. Enter source ~/.bash_profile to make the configuration file take effect immediately.
9. Enter ant -version, if the version number of ant can be displayed, it means that the environment configuration is successful.
Record:
Command+shift+. can display or hide hidden files on the disk.
Command vim to enter the editing state.
~/ is the root directory of the disk.
Enter :w to save the file, and :wq to save and exit the command.