Add the environment variable under mac

Environment variables for the Mac:

a. /etc/profile 
b. /etc/paths 
c. ~/.bash_profile 
d. ~/.bash_login 
e. ~/.profile 
f. ~/.bashrc 
Wherein a and b are 系统级别 , the system will start loading, the user is connected to the remaining other. c, d, e in accordance with the front to back 顺序读取 , if c file exists, the next few documents will be ignored 不读了 , and so on. ~ / .bashrc no such rule, it is loaded bash shell when opened. It is recommended to add the environment variable c , it is to add the following environment variables to demonstrate in the c:
 
Add environment variables:

    1. Open the terminal, the root of the input vim ~ / .bash_profile and open:

     

     2. Enter the following configuration (modified according to its own path) and then save close the window:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home

export PATH=$JAVA_HOME/bin:$PATH

export ANDROID_HOME=/Library/sdk

export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools/

export PATH=$PATH:/usr/local/bin:/usr/local/sbin:${PATH}

     3. Use the "source .bash_profile" to validate the configuration

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/mzhaox/p/11403511.html