Usually we probably use the Windows system the most, but there are also many students who like Mac computers. But for friends who are using Mac computers for the first time, configuring environment variables may become a problem. Let’s talk about how to configure environment variables under Mac.
(Learning video sharing:Programming video)
My mac configuration:
1. Mac system The environment variables, the loading order is:
a. /etc/profile
b. /etc/paths
c. ~/.bash_profile
d. ~/.bash_login
e. ~/.profile
f. ~/.bashrc
2. Among them, a and b are at the system level, which will be loaded when the system starts, and the rest are connected by the user. c, d, e are read in order from front to back. If the c file exists, the following files will be ignored and not read, and so on. ~/.bashrc does not have the above rules, it is loaded when the bash shell is opened. It is recommended to add environment variables in c. The following is also demonstrated by adding environment variables in c. Open Terminal, enter vi ./.bash_profile, press Enter, open the ./.bash_profile file:
##Press Enter: 3. The ./.bash_profile file has been opened, but it is still in view mode and cannot be edited. Enter "i" to enter insert mode4. You can add environment variables at this time, for example:
export SCALA_HOME=/Users/fushuai/Documents/scala-2.12.4 export PATH=$PATH:$SCALA_HOME/bin
The above is the detailed content of How to add environment variables to mac computer. For more information, please follow other related articles on the PHP Chinese website!