Set environment variables on mac to develop programs in unix/linux-based operating systems. It is convenient to use environment variables. By setting environment variables, you can enter the program name in any directory to execute the program under the Set directory. You do not need to change the working directory to the program directory through cd before executing the program. It also saves the trouble of inputting. To put it bluntly, take the following steps (under bash): www.2cto.com 1, open the application-> utility-> terminal; 2, locate your user's home directory in the terminal, and enter: cd ~ 3. Create an empty file and enter touch. bash_profile; 4. Edit this file and enter: open. bash_profile; 5. In this file, enter: export PATH =$ {PATH }:< file directory >;( Replace "<file directory>" with the desired directory) export PATH =$ {PATH}:/Users/rye/android/android-sdk-mac_x86/tools; 6. If you need to add other environment variables such as JAVA_HOME, enter: export JAVA_HOME =/Library/Java/Home; 7, source. bash_profile restart the terminal and test. Author abc20899