Completely master the configuration of environment variables under Mac, no longer need to copy and paste to search

Principle:
In Mac, our environment is added to the PATH path. When the system is running, it will directly find the file /usr/libexec/path_helper. The content inside is the PATH we set through the environment variable, so we set the environment variable as Set by PATH.
Specific configuration:

export M2_HOME=/Users/weixl/Downloads/apache-maven-3.6.3
export MYSQL_HOME=/usr/local/mysql/bin
export PATH=$PATH:$M2_HOME/bin:$MYSQL_HOME

The above is the method of configuring environment variables in the Mac system.
First, find the location of the program you want to set (remember not to appear in Chinese, user=Users in Mac system, download=Dowmloads), and then take this path A name, for example: M2_HOME, and then select the import path path. Note that the path path is the system path recognized by the system by default. Therefore, any configured environment variables are read by the system through path, and then $PATH must be written. It can be placed at the beginning or end or in the middle. Each environment variable is performed by: (note that it is a comma in English) Separate.
After everything is configured,
esc:wq saves and exits.
Use source ./.bash_profile to make the newly modified file effective.
Be sure to remember the above sentence, and it must take effect after each modification, otherwise the environment variable will not take effect.
I wish you all the more you learn! ! !

Guess you like

Origin blog.csdn.net/xiaole060901/article/details/109813574