/ETC/PROFILE;/ETC/BASHRC is a global variable for all users of the system, and only the root user can modify the two files, which is read-only to the average user. General users to modify them, you can add sudo before the command, meaning to execute as root, such as: sudo vi/etc/profile, and then follow the prompts to enter the password.
Therefore, for the general user, we usually recommend modifying the ~/.bash_profile to set the environment variable, which is a user-level setting that is valid only for the current user. Operation steps: 1, open terminal (terminal) 2, Input: VI ~/.bash_profile 3, set Path:export Path=/usr/local/mysql/bin: $PATH 4, enter:: Wq//Save and Exit VI 5, modify effective immediately: source ~/.bash_profile 6, view the value of the environment variable: echo $PATH Note: 1, ~/.bash_profile There is a point 2, if it is a new environment variable or to modify the value of the environment variable, you need to source a bit to take effect immediately. If you delete an environment variable, you must enter exit to logout the current shell, and then reopen a new shell and login to take effect.
Mac OS X configuration environment variables